title: printing div content with css applied
body: <p>I am working on a project and I want to print div content.The code which I am using is fulfilling my requirements,but I am getting simple output without Css applied to it and also not getting the image.Please help me.I am attaching the code and output I am getting and output I want.</p>
  
  <p>Code:
      </p>
  
  <pre><code>function PrintElem(elem) {
      Popup($(elem).html());
  }
  
  function Popup(data) {
      var mywindow = window.open('', 'new div', 'height=400,width=600');
      mywindow.document.write('&lt;html&gt;&lt;head&gt;&lt;title&gt;&lt;/title&gt;');
      mywindow.document.write('&lt;link rel="stylesheet" href="css/midday_receipt.css" type="text/css" /&gt;');
      mywindow.document.write('&lt;/head&gt;&lt;body &gt;');
      mywindow.document.write(data);
      mywindow.document.write('&lt;/body&gt;&lt;/html&gt;');
  
      mywindow.print();
      mywindow.close();
  
      return true;
  }
  </code></pre>
  
  <p></p>
  
  <p>Output I am getting before clicking print button:
  <img src="https://i.stack.imgur.com/6Nrhv.png" alt="enter image description here"></p>
  
  <p>Output I am getting by clicking print button:
  <img src="https://i.stack.imgur.com/Y0uHP.png" alt="enter image description here"></p>