I want to know how to print multiple PDF files in a single print click.
I can easily print single PDF file but I dont know how to print when there are more files.
Thanks in advance.
I want to know how to print multiple PDF files in a single print click.
I can easily print single PDF file but I dont know how to print when there are more files.
Thanks in advance.
Share Improve this question edited Aug 25, 2011 at 8:59 Shadow Wizard 66.4k26 gold badges146 silver badges209 bronze badges asked Aug 25, 2011 at 8:41 zahir hussain zahir hussain 3,73910 gold badges31 silver badges36 bronze badges 8- 1 Do you mean you want a user to click a "print" link somewhere and have 8 copies of a PDF spit out of their printer? Unless you've got a really specific use-case for that, it seems like a usability nightmare waiting to happen. – Scott Commented Aug 25, 2011 at 8:42
- 2 can you explain more clearly? – Jeremy Commented Aug 25, 2011 at 8:43
- i have 8 (for example) pdf seperate file. the user will click all file to print. i did that open each pdf file using each iframe, there is print option, we can take print. but now i need if i select all(8) pdf file, that will be come to one pdf file to print. – zahir hussain Commented Aug 25, 2011 at 8:47
- You want to concatenate all of the pdfs and then print the single concatenated pdf? Could you instead print each pdf separately, in some order? – Spycho Commented Aug 25, 2011 at 8:53
- 2 @Zahir I don't think you can do it with javascript. What you have to do is to merge all "selected" Document to one on the server side (by submitting the document id's). The languages there are more powerful than javascript. – Reporter Commented Aug 25, 2011 at 8:58
2 Answers
Reset to default 9You can call print()
multiple times in your code, resulting in the files being printed one after the other:
function PrintAll() {
var pages = ["page1.pdf", "page2.pdf", "page3.pdf"];
for (var i = 0; i < pages.length; i++) {
var oWindow = window.open(pages[i], "print");
oWindow.print();
oWindow.close();
}
}
Either do as Shodow Wizard suggests and print out the files sequentially or concatenate the files server-side.
You could make an ajax request with the fine names that the user wants to print, concatenate them server side, return the concatenated pdf and then print that out. The concatenation implementation would depend on what server-side language you are using.