maja88g Posted December 3, 2012 Share Posted December 3, 2012 Hi all, I have a iframe that is populated with customer information dynamically from the javascript. The focus is then set to the iframe and an option to print the iframe is displayed. The information loads perfectly in the iframe but does not print the contents of the iframe, instead it prints the contents of the page that is displaying the iframe. As soon as I remove the image from the document.write then the the contents of the iframe are printed out perfectly. Any ideas what I could be doing wrong? Here is my html code: <iframe id="ifmsselectedorderprint" style="display:block; height: 1px; width: 1px; position: absolute"></iframe> Here is my js code: var pri = document.getElementById("ifmsselectedorderprint").contentWindow;pri.document.open();pri.document.write("<table width='800'><tr align='center'><td><img src='orderprint.bmp'></br></br></td></tr></table><label>_________________________________________________________________________________________________________________________</label><h1><font face='tahoma'><center>Cashbuild: Tembi-Mall Community Store Order Print</center></font></h1><label>_________________________________________________________________________________________________________________________</label><h2><font face='tahoma'><center>Order Details</center></font></h2>");pri.document.write("</br><table border='0'><tr><th><font face='tahoma' size='4'>Order No.</font></th><th width='10'></th><th><font face='tahoma' size='4'>SAP No.</font></th><th width='10'></th><th><font face='tahoma' size='4'>Sub Total</font></th><th width='10'></th><th><font face='tahoma' size='4'>Vat</font></th><th width='10'></th><th><font face='tahoma' size='4'>Rounding</font></th><th width='10'></th><th><font face='tahoma' size='4'>Grand Total</font></th></tr><tr><td><font face='tahoma'>"+orderno+"</font></td><td width='10'></td><td><font face='tahoma'>"+sapno+"</font></td><td width='10'></td><td><font face='tahoma'>"+subtotal+"</font></td><td width='10'></td><td><font face='tahoma'>"+vat+"</font></td><td width='10'></td><td><font face='tahoma'>"+rounding+"</font></td><td width='10'></td><td><font face='tahoma'>"+grandtotal+"</font></td></tr></table></br><label>_________________________________________________________________________________________________________________________</label></br>"); pri.document.close();pri.focus();pri.print(); Without the following code: <table width='800'><tr align='center'><td><img src='orderprint.bmp'></br></br></td></tr></table> It works perfectly. I would also like to stress that in both cases the iframe loaded correctly. Thanks for all the help. Link to comment Share on other sites More sharing options...
maja88g Posted December 3, 2012 Author Share Posted December 3, 2012 I have resolved this issue by using an image with a lower resolution. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now