I am trying to create a field within a Fax Cover Sheet PDF that will automatically fill in the total number of pages within the PDF.
I use the PDF as a Template, and then add more pages to it as needed. There is a field in it that says "Pages including cover sheet" which I'd like to default to "1", but change to the number of pages that I add to the PDF document.
Anyone know if this is possible to do?
It's possible, but you have to place the code in a location that will get triggered when you want it to. Options include an "Update" button that you create for this purpose, the Page Open event of the cover page, in which case it will get triggered when you revisit the cover page, a bookmark, etc. The script might look something like:
// Update the value of the page counter field getField("page_counter").value = numPages;
Where "page_counter" is the name of the field.
There is no sort of event like "Page was added", so it can't be quite as automatic as you may want.
Thank you! It worked out perfect!