cannot print popup displaying pdf file

Posted by user369544 on Stack Overflow See other posts from Stack Overflow or by user369544
Published on 2010-06-17T16:39:47Z Indexed on 2010/06/17 16:43 UTC
Read the original article Hit count: 205

Filed under:
|
|

I have a php file with the following code:

<?php

?>
<form action="" id="f1" name="f1">
    <input type="button" name="preview" value="Open PDF" onclick="showPDF()" />
</form>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript">
    function showPDF(){
        var newwin=window.open("pdf.pdf","Window1","menubar=no,width=430,height=360,toolbar=no");
        newwin.print();      
    }
</script>

It opens up a popup window with pdf file inside it BUT fails to open the print dialog box. But the same code without the pdf filename i.e

var newwin=window.open("","Window1","menubar=no,width=430,height=360,toolbar=no");

opens up the popup window and show the print dialog box.

Can anybody provide me a solution to this

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about printing