title: How to create a link that triggers printing of a file?
body: <p>I have some small images and each has a "print larger image" link.</p>
  
  <p>For example:</p>
  
  <pre><code>&lt;img src="thumb.jpg"&gt;
  &lt;a href="#"&gt;Print Larger Image&lt;/a&gt;
  </code></pre>
  
  <p>When the user clicks the "print larger image" link, my goal is to trigger the printing of "big.jpg".</p>
  
  <p>How can this be done?</p>
  
  <p><strong>EDIT: ANTHONY HAD THE RIGHT SOLUTION FOR ME. I MODIFIED HIS CODE A BIT TO GET IT WORKING. HERE'S THE FULL, WORKING CODE</strong></p>
  
  <pre><code>&lt;style&gt;
  @media screen {
  .printimage {
       display: none;
  }
  }
  
  @media print {
  body * {
      display: none;
  }
  .printimage {
       display: block;
  }
  }
  
  &lt;/style&gt;
  
  &lt;a id="bigimage" href="#"&gt;Print Big Image&lt;/a&gt;
  
  &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
   $(document).ready(function(){
  
       $("#bigimage").click(function() {
            $("body").append("&lt;img src='http://sstatic.net/so/img/logo.png' class='printimage' &gt;");
            window.print();
       });
  
  });
  
  &lt;/script&gt;
  </code></pre>