开发者

Printing multiple PDF files using JavaScript

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 whe开发者_StackOverflow中文版n there are more files.

Thanks in advance.


You 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜