?
Solved

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

Posted on 2011-02-11
4
Medium Priority
?
343 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

PDF files have been in the limelight due to its unmatched features.  Personal documents, emails, business reports and eBooks are all converted into PDF files owing to peerless features provided by it. Adding watermark to a PDF file is a method to se…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Suggested Courses

752 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