Hi all,
I am new to JavaScript in Acrobat and I have what I believe to be a simple question.
I have a multipage document that I need to place certain information on each page. On page 1 I have some form fields that the user can put some information in and I have 1 output filed that concatenates these fields and places it on all subsequent pages. As part of the output field I need to include a page number. This is the only part I have not been able to figure out.
Better Break down:
Page 1.
InputText1:
InputText2:
All pages include:
OutputText1 = InputText1 + InputText2 + page number.
Here is an example of the code I have in "Output1"
event.value = this.getField("VersionCode").value + this.getField("ProductCode").value
I have tried using "this.pageNum" with no success.
Because I am copying the "OutputText1" text field to all pages they are all linked to the one on page 1 which gives me an output of 0 for the page number.
The reason I am doing this is to create a static set of images to be printed under multiple conditions. I want the prints automatically labeled using operator input on page 1 of the pdf. Part of what I am outputting is a barcode and it is important for me to know the page number.
I do have Live Cycle Designer but I can't use it for this application.
Any help would be greatly appreciated.
Thanks
What are your input values and what value are you getting for an output value when those input values are used?
For this type of computation I prefer to use the "fillin" function provided in the PDF sample forms as it forces all input values to a string and thus concatenates and does not add numeric fields. One also may have to adjust for the zero based page numbering used within JavaScript.
If I use "12" for the version code and "34" for the product code, the result for your calculation is "46". Even if I include the page number
Document level function:
Field custom calculation script:
event.value = fillin(this.getField("VersionCode").value, this.getField("ProductCode").value, (this.pageNum + 1), "");
George Kaiser