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

Field associated with Pagenumber?

skorpion
Registered: Apr 16 2009
Posts: 7
Answered

Hi
I have made a large document to make my work easier.
The document consists of over 100 pages with many fields. When I created the document I named EVERY field to ItemX (X=pagenumber). Like this: Item1 (for page 1), Item2 (for page 2), Item97 (for page 97). As you can imagine, it took a while to go through all 100 pages and rename all the variables for each page.

Is there an easier way to do this?

If I have like 100 copies of exact same page, with same fields as all the other pages. Is it possible to set a specific field on a specific page to a value? Instead of naming every field to PageXItemY?

Like this:
this.page78.getField("Item").value = event.value

Is it possible?

Thanks in advance

(I hope my english isnt to bad to understand)

Niclas from Sweden

My Product Information:
Acrobat Standard 9.1
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
First, as a general rule, fields names should not contain special characters or spaces. This is because these fields may be used in code, special characters and spaces can make them difficult or impossible to manipulate with a script. This is just a best practice, not an absolute rule.

Another best practice is to give the fields meaningful names, to that when your are referencing the fields in code, or from some external application you can make sense of them.

Naming fields is long and tedious and unfortunately JavaScript cannot be used to directly rename a file. But since you are repeating the same page many times there is something you can do. You can use page templates. Look up page templates in the Acrobat Help and in the Acrobat JavaScript Reference.

All you do is turn the page into a template, and then run some code from the console window to spawn new pages with different field names. This can only be done on Acrobat Standard and Pro. So this is somthing that only you can do to setup your form.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
You might want to look at [url=http://www.planetpdf.com/developer/article.asp?ContentID=a_lesson_in_templates_for_adob&gid=6466]A Lesson in Templates for Adobe Acrobat[/url] by Dave Wright for an article about creating and programing for templates.

George Kaiser

skorpion
Registered: Apr 16 2009
Posts: 7
Thanks
Exactly what I was looking for!

This helps me so much :)

Have a nice weekend!
skorpion
Registered: Apr 16 2009
Posts: 7
Hi again
If I would like to make createTemplate to work with Acrobat Reader, how do I do then?
In the documentation its written that I need version 5 or 6 to do this. It also tells me that "Advanced Form Features rights" needs te be enabled.

How do I enable this? Is it a setting in Acrobat Pro or Acrobat Reader?

/niclas
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Reader does not support templates.

George Kaiser

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Well... Reader does support template. But like you saw in the Reference, it requires the "Templates" Reader Rights Enabling. This is not one of the Rights provided by Acrobat Pro 9. In order to get it you have to purchase it from Adobe. And it's not cheap.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script