Forum Moderators: open

Message Too Old, No Replies

Print content of IFrame

printing iframe

         

richiwatts

3:07 pm on Jul 22, 2005 (gmt 0)

10+ Year Member



Does anyone know of a script that can just print the contents of an Iframe?

Rich

PhraSEOlogy

3:15 pm on Jul 22, 2005 (gmt 0)

10+ Year Member



Rich,

<script>
function iPrint(ptarget)
{
ptarget.focus();
ptarget.print();
}
</script>

<body>
<iframe name="theIFrame" id="theIFrame" width="500" height="200" src="some.file"></iframe>
<input type="button" value="Print IFRAME" onclick="iPrint(theIFrame);" />
</body>

That will do it for you.

richiwatts

3:21 pm on Jul 22, 2005 (gmt 0)

10+ Year Member



Thanks for your really quick response

What if I just want to have text?

Print this page

Trace

5:07 pm on Jul 22, 2005 (gmt 0)

10+ Year Member



<a href="javascript:iPrint(theIFrame);">Print this page</a>

or

<a href="javascript:void();" onClick="iPrint(theIFrame);">Print this page</a>

richiwatts

5:20 pm on Jul 22, 2005 (gmt 0)

10+ Year Member



Sorry guys, please bare with me

Do I replace (theIFrame)with (IFrame URL)?

Rich

richiwatts

6:02 pm on Jul 22, 2005 (gmt 0)

10+ Year Member



Hi,

This text/button is actually in the Iframe

Richi

Trace

6:26 pm on Jul 22, 2005 (gmt 0)

10+ Year Member



If the button is in the iframe which you want printed, only a link like this is needed.

<a href="javascript:print();">Print this page</a>

richiwatts

6:30 pm on Jul 22, 2005 (gmt 0)

10+ Year Member



Thanks for the help but I founfd the answer else where. In case anyone else needs it in the future

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

Put this in each Iframe.

Rich

richiwatts

6:46 pm on Jul 22, 2005 (gmt 0)

10+ Year Member



Nope, thought I had it but this only prints a certain part of the Iframe window and not all of it.

Need your help again please.

Maybe there is a wau to make the actual Iframe pop up in a window and print straight away then close.
The reason I ask this is because if the Iframe pops up and the "print this page" text is still there the user might try to press it again.

I really need help with this one.

Thanks guys

Rich