Solved

form fields need recalculation after pages are inserted or prior to viewing, printing

Posted on 2011-02-11
4
336 Views
Last Modified: 2012-05-11
I have a two-page PDF (sample.pdf) that has a different form field (field01, field02) on each page that contains the formula:

event.value = "Page " + (event.target.page + 1) + " of " + this.numPages;

This lets each page calculate its own position within the document. This works fine until I insert a cover page. The revised document continues to show "Page 1 of 2" and "Page 2 of 2" until I bring up the console and manually call this.calculateNow(). Then the fields recalc and show "Page 2 of 3" and "Page 3 of 3" like I want. I want to change sample.pdf so that it recalculates after pages are added / deleted / moved or before it is viewed or printed. What event can I change so that sample.pdf is an easily insertable component of packets that I create?

TIA,
pT72
0
Comment
Question by:pteranodon72
  • 2
  • 2
4 Comments
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 34880711
The easiest way to accomplish this is by creating a document level script that calls the recalculate function. When you create the script, make sure that you are calling that function outside of the function body that Acrobat suggests by default (you can delete that function, you don't need it).

You still would have to save and reload the document in order for the page numbers to be correct, but the next time somebody will open that document, the page numbers would be correct.
0
 
LVL 14

Author Comment

by:pteranodon72
ID: 34888753
That makes sense. I've read about the Doc/Open event, but Acrobat 8 Pro will only guides me to creating scripts on Will Close, Will Save, Did Save, Will Print, and Did Print actions. If I name my own function in Document Javascripts and then follow the function definition with a call to the function, will that code run at Doc/Open?

Thanks,
pT72
0
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 500 total points
ID: 34889007
As I said, you can create a document level script that will be executed when the document opens. Acrobat will create a function stub for you - you don't need that, so remove that in the editor window. Now anything that you add to the editor window will get executed when the document opens. So, if you just call the is.calculateNow() function (again, this needs to be done outside of a function), it will run when you open the document. Give it a try. If it's not working, I can give you step by step instructions.
0
 
LVL 14

Author Closing Comment

by:pteranodon72
ID: 34889601
That makes sense. I thought the document level scripts were just for definition of functions to be used elsewhere. I didn't realize that code can be called from them and it will run when the document is opened.

Thanks for your help.

pT72
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Have you ever come up with a need of emailing only few pages of PDF file to one of yourfriend or colleague, instead of whole Adobe file? If yes, then surely you have face problems in doing that! Read this section as I have suggested multiple solutio…
*Adobe Acrobat 9 was used for this article.  Particular steps may vary depending on software versions. Adobe Acrobat has many, many variables that my be utilized to customize your forms for clarity and ease of use. The Form Editing Tool will be y…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now