Dear All,
I was looking for a solution to print Iframes in Internet Explorer 7 (IE7)
the command window.print() ( even with window.focus) in an iframe does not work.
The solution is
<script language=javascipt>
document.execCommand('print', false, null);
</script>
I spent alot wasted time figuring this out, hope it helps!
best regards,
Ariel
I am considering making Goofi.com free, any ideas on a revenue model?
Goofi is a Live Chat for website with Audio and Video to comunicate with consumers before a sale.
6 28301
You are the man!! It works!!
used it this way: -
<script type="text/javascript">
-
try
-
{
-
document.execCommand('print', false, null);
-
}
-
catch(e)
-
{
-
window.print();
-
}
-
</script>
-
works perfectly, thanks.
I am in your debt.
Also, I think this might clarify q1712's example if your code executed from the window containing the iframe, as mine is: - <script type="text/javascript">
-
try
-
{
-
iframe = document.getElementById('iframe-id');
-
iframe.contentWindow.document.execCommand('print', false, null);
-
}
-
catch(e)
-
{
-
window.print();
-
}
-
</script>
i got an email when leif send his reply.
he was a PRO using the information the righ way (thx 4 converting it to a parent-frame-script)
anway, there is still an issue i solved, that may be of intrest:
one vession of the windoof-browser (IE7) was not able (able but not willing) to print anything that wasn't rendet.
that means: i always got the printer to print, but sometimes it was an emty page.
so: use this script as an "onload-funtion" put it at the end of the "<body>-tag" or just give it a timeout.
i'd like to post the the script, but i was 2able2 keep my job, and i'll never ever steal code form my former employ.
Thank you for saving me time. May i add this is the only code that will print full frame in IE8 and IE9.
parent.framename.print(); does not work.
window.print(); does not work.
The above only prints a portion of the visible frame, if you have scrolling it does not print the rest of the page.
Here is my print frame solution based on your code
In head: -
<script type="text/javascript">
-
function printfrm() {
-
document.execCommand('print', false, null);
-
}
-
</script>
-
Then in the body: -
<input type="button" value="Print this page" onClick="printfrm();" />
-
what if we have more than 1 iframe in a page.how can i print all the content of iframe without truncating.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Marina Ferguson |
last post by:
Hi,
I have a document with an iframe. The main doc has a "Print" button. The
idea is that when the user clicks it, the contents of the iframe is printed.
For some reason instead of the iframe...
|
by: Vince |
last post by:
I have a generic page that I use for printing content, and it contains
an iframe into which I put the url for the page to be printed. I
dynamically size the iframe so that it correctly displays...
|
by: nightstar |
last post by:
I am creating a web page that will contain multiple Iframes. One of
the Iframes will contain a bill of sale that is generated by a script
on x.mydomain.com/somefile.php?someparameters. One of the...
|
by: Poonam |
last post by:
Hi
I have a page where there is table and below the table there is 'iframe', This page also has 'Print' button. Printing this page is printing the table and iframe contents on 2 different...
|
by: jon |
last post by:
I'm trying to use a hidden iframe to print the contents of one div
seamlessly. Currently I can create the hidden iframe, copy the
contents of the div to the iframe, and print it. I even have a...
|
by: DevGeeta |
last post by:
Hi,
I have one page with Iframe ...The issue is to Print a page with all data from Iframe also.
I tried doing window.print() this print whole page.But not all data from Iframe.
Also when...
|
by: jay123 |
last post by:
hello,
i really need help from you experts.
my problem is i have one page abc.aspx, and then their is other page called def.aspx(which is printable version), which gives some information used...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |