开发者

Restoring selected printer in Acrobat Reader after calling this.print from javascript

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 = p开发者_如何学编程arams.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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜