title: Print a pdf displayed in <object> tag angular2
body: <p>I have created a popup in Angular2 which will show PDF file from server like a report viewer, This PDF is embeded in  tag like below</p>
  
  <pre><code>&lt;object width="870" height="650" type="application/pdf" data="http://localhost/amar/test.pdf?#zoom=85&amp;scrollbar=0&amp;toolbar=0&amp;navpanes=0" id="doc"&gt;
   &lt;/object&gt;
  </code></pre>
  
  <p>i tried to open it in a new window and then print like mentioned in several examples, but it wasnt working</p>
  
  <pre><code>    var URL = "http://localhost/amar/test.pdf";
      var printWindow = window.open(URL);
      printWindow.print() 
     //Not working
  </code></pre>
  
  <p>i tried with postMessage() it was also not working</p>
  
  <pre><code> var PrintThis = function (val) {
         printWindow.focus();
         printWindow.print();
  
      }
  
      printWindow.addEventListener("message", PrintThis);
      printWindow.postMessage("Print", "*");
      //in this case iam able to get the data in printhis()
      //but its also not working
  </code></pre>
  
  <p>Please help or provide me with ideas about how can i print a PDF in angular2 Or Javascript</p>