Print Iframe

Asked

Viewed 658 times

1

I am trying to print an iframe I have on a page of my site, but the print window is not opening when I use the following code:

function printFunction() {
	window.frames["printf"].focus();
	window.frames["printf"].print();
}
<iframe id="printf" name="printf"></iframe>

And when I only use windows.print();.... it opens the print window, but prints the whole page, not just the contents of the iframe!

function printFunction() {
	window.print();
}
<iframe id="printf" name="printf"></iframe >

NOTE: The print button will call the printFunction() by onclick;

Does anyone know what it can be?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.