...

View Full Version : Printing PDF in browser window



jacob999
05-14-2007, 07:04 AM
Hi,
On click of a button, i am opening a PDF doc in the browser window. I want to seamlessly issue the print command when the page is opened so that the user does not see the pdf ; rather he should be directly taken to the print settings screen.

I tried using the below code ...

var win = window.open(<pdf doc url>);
win.print();
win.close();

This opens the pdf in a new window but does not issue the print command.
The domain name for both the base page url and the pdf url is the same (localhost).

Any ideas on this will be highly appreciated!!

Regards,
Jacob

Philip M
05-14-2007, 11:45 AM
Have you tried

window.open(<pdf doc url>);
window.print();
window.close();

glenngv
05-14-2007, 07:21 PM
Have you tried

window.open(<pdf doc url>);
window.print();
window.close();
That will print the window that opens the pdf.

You won't be able to call the print() method (or any other method for that matter) of the window object if that window contains non-HTML page.

felgall
05-14-2007, 08:54 PM
You need the JavaScript within the PDF if you want that to happen.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum