Is there a way to print a pdf document without opening it, if user just select the pdf files in the checkbox and click a button?
I tried the following two methods, but both fail.
1. open a new window:
[CODE=javascript]win=window.open ("","","widt h=5 height=5");
win.blur();
win.document.lo cation="http://www.mydomain.co m/mydoc.pdf";
win.print();
win.close();
[/CODE]
2. use iframe:
[CODE=javascript]iframe = document.create Element("IFRAME ");
iframe.setAttri bute("id","test iframe");
iframe.setAttri bute("name","te stiframe");
iframe.setAttri bute("src", "http://www.mydomain.co m/mydoc.pdf");
iframe.style.di splay = "none";
window.document .body.appendChi ld(iframe);
var x = document.getEle mentById("testi frame");
x.focus();
x.print();
[/CODE]
Did I miss anything? Or it is completely impossible to print pdf without opening it. Thanks a lot!
P.S. I found this forum is very helpful. It helps me solve many problems, so I posted this message first time here. Thanks for your answer in advance!
I tried the following two methods, but both fail.
1. open a new window:
[CODE=javascript]win=window.open ("","","widt h=5 height=5");
win.blur();
win.document.lo cation="http://www.mydomain.co m/mydoc.pdf";
win.print();
win.close();
[/CODE]
2. use iframe:
[CODE=javascript]iframe = document.create Element("IFRAME ");
iframe.setAttri bute("id","test iframe");
iframe.setAttri bute("name","te stiframe");
iframe.setAttri bute("src", "http://www.mydomain.co m/mydoc.pdf");
iframe.style.di splay = "none";
window.document .body.appendChi ld(iframe);
var x = document.getEle mentById("testi frame");
x.focus();
x.print();
[/CODE]
Did I miss anything? Or it is completely impossible to print pdf without opening it. Thanks a lot!
P.S. I found this forum is very helpful. It helps me solve many problems, so I posted this message first time here. Thanks for your answer in advance!
Comment