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

How to find print event?

vios
Registered: Jan 22 2008
Posts: 3

I want write javascript into a pdf file,to record times of file have been printed.

In my opinion,first I must find out "print event",then using the format "if (print event happened) {}" to do it.

I saw an event named "didprint" in Acrobat JavaScript Scripting Reference,but i don't know how to use it,and there is on example in internet.

so how can i do it?

Thanks in advance for any help you can provide!

Regards,

vios

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Within Acrobat it is a document event, and its location depencs upon which version of Acrobat you have.

You will have to create either a subscribed global variable for each pdf you are going to count or create field within the PDF or connect to a data base.
Global variable space is limited so a field or connecting to a data base would work better for a large number of files.

Updating fields can have sharing issues and the form has to be a network and saved back to the orignial file after each print.

Also if any of your users have Reader there are saving rights issues and all users will be prompted to save the PDF.

For a field within the PDF created with Acrobat Froms Tool and not LiveCycle Designer, you can add the following "Will Print" script to update a field called "TimesPrinted":

this.getField("TimesPrinted").value = this.getField("TimesPrinted").value++

Data base updates are complex.

I would talk with your sysadmin and see if there is not a system level solution.

George Kaiser

vios
Registered: Jan 22 2008
Posts: 3
excuse me how can i write the willprint event?
is there any example,i have no idea how to write it.
like
var pp = event.target;
if(pp.WillPrint)
{

}

it can not work

so how can i make it work?

Regards,

vios