Trawling about the bowels of the Internet I did find an option that
*should* work. The syntax looks something like:
<html>
<body onLoad="document.getElementById('renderedPDF').print()">
<OBJECT
name='renderedPDF'
id='renderedPDF'
CLASSID='clsid:CA8A9780-280D-11CF-A24D-444553540000'
WIDTH="100%"
HEIGHT="100%">
<PARAM NAME='SRC' VALUE='http://pathToPDFCreatorScript.cfm'>
<EMBED SRC='http://pathToPDFCreatorScript.cfm'
HEIGHT="100%" WIDTH="100%"> <NOEMBED> Your browser does not support
embedded PDF files. </NOEMBED>
</EMBED>
</OBJECT>
</body>
</html>
Unfortunately this doesn't seem to work. First I was trying to use
printWithDialog() instead of print() but printWithDialog appears to be
an IE only solution (?). Next thought was that even though the body
onLoad event fires before the PDF loads - something that might cause
the javascript error that "Object #<an HTMLObjectElement> has no
method 'print'". However, doing something like:
function printDocument(documentId) {
//Wait until PDF is ready to print
if (typeof
document.getElementById(documentId).print ==
'undefined') {
setTimeout(function(){printDocument(documentId);}, 1000);
} else {
var x =
document.getElementById(documentId);
x.printWithDialog();
}
}
is also a problem. Turns out that the embedded object REALLY DOESN'T
HAVE a print method and all this does is cause the browser to poll
itself into infinitum.
Does anyone have any insight on what functions on an embedded pdf that
javascript might have access to call? Would one of them be print?
- Matthew
--
tag/function ref: http://www.openbluedragon.org/manual/
mailing list - http://groups.google.com/group/openbd?hl=en
Get to Texas in Feb for OpenCFSummit http://www.opencfsummit.org/