Helpful Information
 
 
Category: HTML & CSS
Print iFrame Content

Does anybody of u know how to print the content of an iFrame? The Content of the iFrame is just another HTML Page!!!

Thanx and Cheers,
Sepp

right click in the IFrame and select "Print"

this will print the page inside the iframe.


Alternately you could have a button that says "click here to print" or something like that... try this:

In the page that's inside the iframe put this:



<a href="#" onClick="print(); return false;">click here to print this page</a>


that should work.

don't want to put it INSIDE the iFrame!!!!

That's my problem!

Thanx anyway!

whoa, settle down!!!

Explain exactly what you want to do then...

~Quack

Brief:
<script type="text/javascript">
function zPrint(oTgt)
{
oTgt.focus();
oTgt.print();
}
</script>

.
.
.
<body>
<iframe name="myFrame" id="myFrame" width="600" height="400" src="about:mozilla></iframe>
<input type="button" value="Print IFRAME" onclick="zPrint(myFrame);" />
</body>

I exactly wanted to do what ZVONA did offer me!!!!
Thanx man :thumbsup:

What if I only want my frame to be printed if I press ctrl+p or if I choose print in the menu, how can I do that?

Brief:
<script type="text/javascript">
function zPrint(oTgt)
{
oTgt.focus();
oTgt.print();
}
</script>

.
.
.
<body>
<iframe name="myFrame" id="myFrame" width="600" height="400" src="about:mozilla></iframe>
<input type="button" value="Print IFRAME" onclick="zPrint(myFrame);" />
</body>



How could you fix same csolution using this code? for me it doesn´t work
I wanna print pictures iframe from the header iframe
<div id="wrapper">
<div id="header">
<iframe id="header" src="header.html" ></iframe>

</div>
<div id="content">
<iframe id="pictures" src="arm001.html" Scrolling="no"> </iframe>

</div>
<div id="footer"><iframe id="footer" src="footer.html" > </iframe></div>
</div>
</body>

check the look here:
http://www.pixelperu.net/iframe/iframe.jpg

I have used above to print a pdf document in an iframe successfully on firefox, but it doesn't seem to work on IE8. The print dialog comes up, but nothing prints.

Anybody else experienced this, or know how to make it work.

Zvona - thanks for the hack!! It is one of the very few I ever found on a coder blog that I just dropped in and it worked










privacy (GDPR)