Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-02-11
4
Medium Priority
?
344 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

609 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