Reputation: 481
I am currently using the following script for a few documents:
var pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.automatic;
this.print(pp);
How do I add another command, say document.close()
so that it reads the print function and then follows the close document last? Do I simply add the close command right after the print command so it would read
var pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.automatic;
this.print(pp);
document.close();
Thanks.
ADDITION
My problem here is I cannot figure out how to finish off one command and get right into the next. I have given up on trying to make the document close, since I realized it will open in the browser. So now my next idea is to use history.back(-1);
after the print command. I just don't understand how to start/stop commands in the javascript.
Upvotes: 4
Views: 1403
Reputation: 51735
The print
function should block (pause) until the user finishes dealing with the print dialog, then continue. You don't have to do anything special to run more code after it.
That said, do you really need to force the document to close after it prints? As a user, I'd be pretty miffed if a website did this to me. What if I want to save the PDF to my computer? What if my printer was low on ink and I need to print it again? Let me decide when to close your PDF.
Upvotes: 0