Javascript Print Pdf file by IFrame

0
0

Hi Wisej,

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

with .htm file done.

but .pdf file not done.

Thank you.

Attachment
  • You must to post comments
0
0

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
0
0

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 https://www.w3schools.com/jsref/event_onload.asp

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

var objFra = document.createElement('iframe'); // Create an IFrame.
objFra.style.visibility = "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.