title: Printing a picture attachment in a asp.net website
body: <p>I'm trying to print an image that shows on a web page, but I cannot seem to print the image.</p>
  
  <p>The following code is from <a href="https://stackoverflow.com/questions/1071962/how-to-print-part-of-rendered-html-page-in-javascript/1072151#1072151">how to print part of rendered html page in javascript?</a>, but this only prints a page with a title but no image</p>
  
  <p>What am I doing wrong?</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Print Test Page&lt;/title&gt;
          &lt;script language="javascript" type="text/javascript"&gt;
              printDivCSS = new String ('&lt;link href="myprintstyle.css" rel="stylesheet" type="text/css"&gt;')
              function printDiv(divId) {
                  window.frames["print_frame"].document.body.innerHTML=printDivCSS + document.getElementById(divId).innerHTML;
                  window.frames["print_frame"].window.focus();
                  window.frames["print_frame"].window.print();
              }
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h1&gt;&lt;b&gt;&lt;center&gt;This is a test page for printing&lt;/center&gt;&lt;/b&gt;&lt;hr color=#00cc00 width=95%&gt;&lt;/h1&gt;
          &lt;b&gt;Div 1:&lt;/b&gt; &lt;a href="javascript:printDiv('div1')"&gt;Print&lt;/a&gt;&lt;br /&gt;
          &lt;div id="div1"&gt;
              &lt;img src="C:/Users/Usuario/Desktop/descarga.jpg" id="imagehtml" class="img-responsive" alt="Visualización del original de la forma migratoria" /&gt;
          &lt;/div&gt;
          &lt;br /&gt;&lt;br /&gt;
          &lt;b&gt;Div 2:&lt;/b&gt; &lt;a href="javascript:printDiv('div2')"&gt;Print&lt;/a&gt;&lt;br /&gt;
          &lt;div id="div2"&gt;This is the div2's print output&lt;/div&gt;
          &lt;br /&gt;&lt;br /&gt;
          &lt;b&gt;Div 3:&lt;/b&gt; &lt;a href="javascript:printDiv('div3')"&gt;Print&lt;/a&gt;&lt;br /&gt;
          &lt;div id="div3"&gt;This is the div3's print output&lt;/div&gt;
          &lt;iframe name="print_frame" width="0" height="0" frameborder="0" src="about:blank"&gt;&lt;/iframe&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>