...

View Full Version : Iframe not working in IE7



john1872
05-26-2009, 04:05 PM
Hi All,

Below mentioned code prints properly in Mozila but not in IE7 any help on this would be greatful.

<HTML>
<script Language="javascript">

function printfile()
{
for (var i=0; i<window.frames.length; i++)
{
//Mozilla
parent.objAdobePrint.focus();-- Prints in Mozilla & not in IE
parent.objAdobePrint.print();-- Prints in Mozilla & not in IE
//IE
// window.frames['objAdobePrint'].focus();
// window.frames['objAdobePrint'].print();
}
}

</script>
<BODY>

<iframe src="1.pdf" id="objAdobePrint" name="objAdobePrint" height="250" width="100%" frameborder=0></iframe><br>

<input type="button" value="Print" onclick="javascript: printfile();">



</BODY>
</HTML>

Thanks,
John

itsallkizza
05-26-2009, 04:28 PM
This works in IE and FF just fine:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Test</title>
<style type="text/css">
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
// <![CDATA[

function printIframe()
{
var iframe_window = window.frames["my_iframe"];
iframe_window.print();
}

// ]]>
</script>
</head>
<body>

<iframe name="my_iframe" id="my_iframe" src="example.html"></iframe>

<input type="button" value="print iframe" onclick="printIframe()" />

</body>
</html>


Don't use the "javascript:" string prefix for your onclick definition.

john1872
05-26-2009, 05:05 PM
Thanks for your quick replay right now printer is not available i will check code by tomorrow & get back to you.Before that inside the iframe i am having the PDF which is having merely 50 pages whether all the pages will be printed by using above attached code?. Kindly let me know.

Thanks,
John

john1872
05-27-2009, 10:30 AM
Hi,

Still the same problem: i am having a pdf with 2 pages in FF both pages are printing (By using above suggested code)but in IE7 only single blank page is printing any suggestion would be greatful.
Thanks,
John

john1872
05-27-2009, 10:46 AM
Hi All,

Waiting for your suggestions in so many forums above mentioned problem is not answered but i am expecting the answer from this forum & its urgent too.

Thanks,
John

john1872
05-27-2009, 01:42 PM
Very simple issue it takes too long to fix expecting experts help to solve anyone is there to help me or i want to know is it possible to print multiple page pdf in IE7(inside iframe) any help would be appreciated

itsallkizza
05-27-2009, 03:12 PM
(without testing) i would say that if time is an issue you could simply do what most sites do and give a link to the pdf so the user can choose to view/print it as they wish. then you don't have browser quirks with the printing because it'll be an adobe plugin that does all the work.

jasmibabu
07-09-2010, 08:22 AM
could you provide a solution if the iframe content is not a pdf but another html(.aspx) page which is longer than 1 page.
Appreciate any help posted



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum