views:

150

answers:

2

Hi,

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.

+1  A: 

add this history.go(-1); instead of history.back(-1);

M A Hossain Tonu
Thanks M A. I couldn't get it to work, but I will try again.
godleuf
A: 

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.

Sidnicious
Thanks for the response Sid, but I failed to mention that this will be printed from inside a bank at a touch screen kiosk. The kiosk is just an html website run locally in Explorer with the toolbars, etc hidden. Once the pdf opens, I need it to be printed then return the user to the site. Right now, the pdf opens in Reader whether through the browser or separately I am not exactly sure so at first I tried to use the close document command. Either way it needs to return to the main site after it's printed.
godleuf