Javascript Print Pdf file by IFrame


Hi Wisej,

I am using IFrame in javaScript to Print the Document file.

with .htm file done.

but .pdf file not done.

Thank you.

  • You must to post comments

Hi Luca (ITG),

I am using crystalReport. It allows export to Memory stream pdf.

How to do showing Memory stream pdf into IFrame javaScript?

Thank you so much.

  • You must to post comments

Documents in browsers are loaded asynchronously. If you print after assigning the src the iframe is empty. You can use jsfiddle to test your javascript code. See

In your code you can try to change it like this:

var objFra = document.createElement('iframe'); // Create an IFrame. = "hidden"; // Hide the frame.
objFra.src = "ReadMe_001.pdf"; // Set source not done .pdf.
objFra.onload = function(){
   objFra.contentWindow.focus(); // Set focus.
   objFra.contentWindow.print(); // Print it  
document.body.appendChild(objFra); // Add the frame to the web page.


  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.