Open GoogleCodeExporter opened 9 years ago
The sample provided is ready to reproduce this issue, copy it and PDF documents
in the same path of the applet, open it and click on the red button.
Original comment by jesusdel...@gmail.com
on 26 Mar 2015 at 10:47
We don't yet support multiple adjacent appends with any of our 2d type
functions (html, pdf, etc). Instead, you'll have to wait for append, print the
contents, wait for printing to finish, append again.
I understand this is cumbersome from a coding perspective to impliment. Once
QZ Tray is stable, we have plans to clean this up to allow the queuing of 2d
documents as well as other queuing and multiple document/multiple printer
enhancements.
Original comment by tres.fin...@gmail.com
on 26 Mar 2015 at 12:52
Thank you for your reply.
How can wait to complete first to process de second document, I tried this:
function Wait()
{
while (!qz.isDonePrinting() || !qz.isDoneAppending())
{}
}
function printPDF()
{
printPDFDocument("one.pdf")
Wait()
printPDFDocument("two.pdf")
}
Did not work, any ideas?
Thanks.
Original comment by jesusdel...@gmail.com
on 26 Mar 2015 at 1:01
Please don't use while loops, that can deadlock your browser.
This should be your execution order:
> qz.appendPDF("/path/to/file1.pdf");
Wait for appending to finish:
> function qzDoneAppending() {
> qz.printPS();
> }
Wait for printing to finish:
> function qzDonePrinting() {
> qz.appendPDF("/path/to/file2.pdf");
> }
Before you try this... you'l need a counter to track which file you are on to
not get into an infinite loop!
Original comment by tres.fin...@gmail.com
on 26 Mar 2015 at 1:47
The While was just a test to try to stop it, nothing serious.
I´ll try as you said.
Thanks again.
Original comment by jesusdel...@gmail.com
on 26 Mar 2015 at 3:24
We used while loops a few years ago, and for these PDF tasks specifically, they
would cause sporatic deadlocks.
This is because there was no concept of "wait()" or "doEvents()" that gave time
for the window. Because of this, setTimeout() is going to yield much more
stable results and that is a pretty good rule to follow with waiting in JS in
general.
If I recall correctly, FF and Chrome could handle it a bit better, but I'd hate
for a blocking action to yield poor results. :)
Original comment by tres.fin...@gmail.com
on 26 Mar 2015 at 3:32
Original issue reported on code.google.com by
jesusdel...@gmail.com
on 26 Mar 2015 at 10:07Attachments: