[CLOSED] JavaScript IFrame center of screen

Answered Closed
0
0

Hi Wisej,

How to put IFrame on center of screen by in this JavaScript code?

function PrintPdf(src) {
    var objFra = document.createElement(‘iframe’); // Create an IFrame.
objFra.style.visibility = “hidden”; // Hide the frame.
objFra.src = src; // 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.
}

Thank you.

  • You must to post comments
Best Answer
0
0

Hi Huỳnh,

You’ll need to play around with the CSS styling.

Here is a post that might be useful:

https://stackoverflow.com/questions/20583088/how-to-align-iframe-always-in-the-center

Best,

Levie

  • You must to post comments
Showing 1 result