views:

14

answers:

0

Is there a way to save off the current printer before printing and restore it after calling "this.print"?

Our web application prints many reports. Most reports are generated and displayed in an iframe on the current web page being viewed. The user can then print by interacting with Adobe's menus.

A small number of our reports need to print automatically to a specific printer. When generating these reports we add the following JavaScript to the PDF. The PDF is then loaded into a hidden iframe and printed.

var params = this.getPrintParams();
params.interactive=params.constants.interactionLevel.silent;
params.pageHandling=params.constants.handling.none;
params.printerName="LabelPrinter"
this.print(params);

This works great and the file is printed to the correct printer.

The problem comes when printing the next report. When the user clicks Adobe's print button, the selected printer will be the one that was set when calling "this.print". May times the user doesn't see the wrong printer is selected and prints regular reports to the label printer.

I would like to do something like the following...

var params = this.getPrintParams();
var currentPrinter = params.printerName;
params.interactive=params.constants.interactionLevel.silent;
params.pageHandling=params.constants.handling.none;
params.printerName="LabelPrinter"
this.print(params);

//set it back here by calling something like
this.SetCurrentPrinter(currentPrinter);

Thanks for your help Mike