JavaScript - Print iframes content pdf file using javascript in safari browser

Asked By Ganesan BalaKrishnan on 13-May-09 07:06 AM
<HTML>
<script Language="javascript">

function printfile()
{ 
window.frames['objAdobePrint'].focus();
window.frames['objAdobePrint'].print();
} 

</script>
<BODY>

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

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

</BODY>
</HTML>

the above code working in Firefox browser, but its not working in safari browser.

if i try to print this pdf file in safari browser i am getting empty page print out.

if i open any pdf file in firefox browser, i can print that pdf file from toolbar File->Print option,
but its not working for safari browser.

any one can help me for above issue?
Santhosh N replied to Ganesan BalaKrishnan on 13-May-09 10:36 AM
Safari browser handles the pdf files seperately and it has its own viewer unlike other browsers which calls the pdf viewers to open the files...

check here for more info on how to control the viewer..

http://forums.macrumors.com/archive/index.php/t-131569.html

http://www.cjrtools.com/ebooks/mac-tutorials/safari-pdf.html
Ganesan BalaKrishnan replied to Santhosh N on 13-May-09 11:16 AM

How & where to run the following command

defaults write com.apple.Safari WebKitOmitPDFSupport -bool YES