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

Counting the number of print copies

Niall
Expert
Registered: Apr 26 2006
Posts: 62
Answered

Hi,

I am trying to access the number of copies selected by the user in the print dialog. It is default "1", but the suer can override this and input any number.

The user will be using Reader and the form is not Reader Enabled. Since a silent print button doesn't seem to be an option here

I currently have a counter on the willPrint action that advances by "1" every time the document is printed. But what I am really after is to have the counter display the total number of copies printed.

Is there a means of getting the inputted number of copies and passing this to the willPrint doc-action before it actually prints?

Any advice?

Thanks,

Niall

Hope this helps,

Niall
Assure Dynamics

My Product Information:
Reader 9.3, Windows
UVSAR
Online
Expert
Registered: Oct 29 2008
Posts: 1357
No there isn't - the print dialog doesn't report the number of copies back to the PrintParams object.
Niall
Expert
Registered: Apr 26 2006
Posts: 62
Thanks, afraid of that!

Niall

Hope this helps,

Niall
Assure Dynamics

radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
In Designer I can limit the number of copies to 1 with the following script.

var PNC = event.target.getPrintParams().NumCopies.toString();if(PNC == 1){var pp = event.target.getPrintParams();event.target.print(pp);}else{xfa.event.cancelAction = 1;}

The number of copies still can be changed by the uses, but then a message appears, that explains, that only one copy is allowed.
You maybe can do this with AcroForms too.

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

Niall
Expert
Registered: Apr 26 2006
Posts: 62
Thanks radzmar,

I tried the following (commenting out the getPrintParams in the if statement) and in all cases PNC returned "1", even if the user inputted more than one copy.

var y = this.getField("copiesNrWill");var PNC = this.getPrintParams().NumCopies.toString(); app.alert("Copies: " + PNC); if(PNC == 1){//y.value += 1;    //var pp = this.getPrintParams();//this.print(pp);app.alert("Yes");}else{app.alert("You are only permitted to print one copy at a time. Please go back and select 1 copy. \n\nThanks!");}

Thanks,

Niall

ps: I tried both willPrint and didPrint doc-actions and same result PNC=1.

Hope this helps,

Niall
Assure Dynamics

radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Well, as Dave mentioned before, it seems to be not possible to return the selected number of copies.

But you can use a custom print button in your form, that will limit the number of copies to 1, because
you can use the cancelAction method in AcroForms too.

var PNC = this.getPrintParams().NumCopies.toString(); if(PNC == 1){var pp = this.getPrintParams();this.print(pp);app.alert("1 Copy was printed");}else{this.cancelAction = 1;}

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

UVSAR
Online
Expert
Registered: Oct 29 2008
Posts: 1357
Unfortunately as I said, in Acrobat that parameter isn't set by the dialog box. You can write to it when firing your own print event, but during a willPrint loop the entire PrintParams object is read only.
Niall
Expert
Registered: Apr 26 2006
Posts: 62
Thanks lads,

I think I will put it aside as an approach. Even if I had a custom print button, there are too many ways around this (Control+P, print button on toolbar and file>print).Thanks very much for the input.

Niall

Hope this helps,

Niall
Assure Dynamics