views:

23

answers:

1

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

A: 

does this work?

newwin.printWithDialog();
Colin Pickard
thanks for the reply but it does not work. any other way?