These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Problem printing to a network printer with javascript

rtibaldi
Registered: Nov 26 2007
Posts: 2

Hi,
I have the following problem:
I have successfully added a javascript to a pdf in order to print it silently to a local printer.
The java code to do it is the following:
var pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.silent;
pp.printerName = "hp psc 1310 series";
this.print(pp);
If printerName is a local printer, everything works fine.
On the contrary if printerName is a network printer (\\\\servername\\printername), nothing happens.
The network printer is on and if I print interactively a pdf document to it, it works well. What do I miss?

My Product Information:
Reader 7.0.7, Windows
lkassuba
ExpertTeam
Registered: Jun 28 2007
Posts: 3636
Hi rtibaldi,

Have you tried adding this javascript in a folder level script (priviledged context)? Printers can be selected with the Acrobat Javascipt print funtion but silent printing is only allowed from a priviledged context.

Hope this helps,
Lori

Lori Kassuba is an AUC Expert and Community Manager for AcrobatUsers.com.

skrdigital
Registered: Feb 22 2009
Posts: 16
Hi


This is Kumar, I have prepared one form in that I have created 3 fields and print button.
the field name are Text_01, Text_02 & Text_03. OK.
when the user typed the value in the Text_01, Text_02 & Text_03 fields & press the print button.the requirement is:

it should print silently(all the pages in the pdf) and printer name is Adobe PDF and it should save in a d:\ drive with the value of Text_01 field.

Could you help in this regards, this will be greatful for me.

I have very less knowledge in Javascripting.
Could you modify the below script as per my requirement and post me.

var pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.silent;
pp.printerName = "hp psc 1310 series";
this.print(pp);


Thanks a lot.
Kumar.
skrdigital
Registered: Feb 22 2009
Posts: 16
Hi,

Can i update the script in the acrobat professional CS
from button > right Click > properties > Action > Run the JavaScript.Please do need full.
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
No.

Have you read the Acrobat JS API Referecne?

Any version above version 7 has some additional restrictions.

Quote:
Note:(Acrobat 7.0) Non-interactive printing can only be executed during batch, console, and menu events. Printing is made non-interactive by setting bUI to false when calling the Doc print method or by setting the interactive property to silent, for example,var pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.silent;Outside of batch, console, and menu events, the values of bUI and of interactive are ignored, and a print dialog box will always be presented.
So you will need a folder level script to either add menu button or a foler level function to create a trused fucntion.

// folder level JS codetrustedSilentPrint = app.trustedFunction (function(sPrinter) {app.beginPriv(); // raise privilege// get printer parametersvar pp = this.getPrintParams();// set interaction level to silentpp.interactive = pp.constants.interactionLevel.silent;// use printer name if providedif (sPrinter != '')pp.printerName = sPrinter;// print using the print parametersthis.print(pp);app.endPriv(); // end raised privilege} // end app.trustedFunciton ) // end trusted Silent Print definition// end folder level JS code

// button up action JS code to call trustedSilentPrint// assign printer namevar NetPrinterName = "hp psc 1310 series";// call trusted fucnction with printer nameturstedSilenPrint(sPrinter);

George Kaiser