Log in

View Full Version : Printing Iframe with embedded Google Document



thompa
11-10-2009, 02:09 AM
Hi there,

To print an Iframe, I normally use a routine like:-

<!--<script type="text/javascript">
function PrintIframe(){
try{
var oIframe = document.getElementById('mixedtabletoprint');
var oContent = document.getElementById('divToPrint').innerHTML;
var oDoc = (oIframe.contentWindow || oIframe.contentDocument);
if (oDoc.document) oDoc = oDoc.document;
oDoc.write("<html><head><title>title</title>");
oDoc.write("</head><body onload='this.focus(); this.print();'>");
oDoc.write(oContent + "</body></html>");
oDoc.close();
}
catch(e){
self.print();
}
}
</script> -->

and then use:-
<form><input name='button1' type='button' onClick='PrintIframe();' value=' Print ' ></form>

to create a button to print the Iframe.

However, this doesn't work if the Iframe contains an embedded Google document like a spreadsheet.
Google's method of embedding in a web page requires the <iframe> format.

Can anyone point me in the right direction to be able to print an iframe with the click of a button on the page?

thanks in anticipation,

regards
Allan