title: Silent print an embedded PDF
body: <p>I have a web page with embedded PDF on it. My code looks like this:</p>
  
  <pre><code>&lt;embed
      type="application/pdf"
      src="path_to_pdf_document.pdf"
      id="pdfDocument"
      width="100%"
      height="100%"&gt;
  &lt;/embed&gt;
  </code></pre>
  
  <p>I have this javascript code for print my PDF:</p>
  
  <pre><code>function printDocument(documentId) {
  
      //Wait until PDF is ready to print    
      if (typeof document.getElementById(documentId).print == 'undefined') {
  
          setTimeout(function(){printDocument(documentId);}, 1000);
  
      } else {
  
          var x = document.getElementById(documentId);
          x.print();
      }
  }
  </code></pre>
  
  <p>When this code is executed Acrobat plug-in opens the well-known print dialog. Something like this:</p>
  
  <p><img src="https://i.stack.imgur.com/Couqn.jpg" alt="PrintDialog"></p>
  
  <p>Two questions:</p>
  
  <ul>
  <li>How to improve the way to detect that PDF is loaded and ready for print?</li>
  <li>How to avoid showing print dialog?</li>
  </ul>
  
  <p>A little more info about my system:</p>
  
  <p><strong>OS:</strong> Windows XP</p>
  
  <p><strong>Browser:</strong> Internet Explorer 7</p>
  
  <p><strong>PDF Plugin:</strong> Acrobat Reader 9</p>