Add Repeating PDF Pages with a Button in Adobe Acrobat
Question details
Create an interactive PDF form with a button that adds up to twelve copies of a page and numbers their headings.

- Product
- Adobe Acrobat Pro
- Device & OS
- not provided
- Scenario
- A form needs additional pages on demand, each with its own heading and independent form fields.
- Observed behavior
- Each button click should add a page with the next heading, from Title 1 through Title 12.
Open the form in desktop Adobe Acrobat Pro and prepare the page you want to repeat. Make sure Acrobat JavaScript is enabled and decide which form fields each copy needs.
Use a hidden page template and a button script in Acrobat
Use this method to add numbered copies on demand while keeping their form fields separate.
The example uses a hidden page template named RepeatPage, a text field named Heading on that template, and a hidden counter field named CopyCount outside the template. The script appends pages and stops after twelve copies.
In Acrobat Pro, open All tools > Prepare a form. Add a text field named Heading to the page you want to repeat, along with any other fields needed on each copy.
In Prepare a form, open More > Page Templates. Create a template from the repeating page, name it RepeatPage, and hide it using the Page Templates dialog.
On a page that remains visible, add a text field named CopyCount with a default value of 0, then set its visibility to Hidden in its Properties. Add a button labeled Add Page.
Open the button's Properties > Actions. Select Mouse Up as the trigger and Run a JavaScript as the action, then add this script: var counter = this.getField("CopyCount"); var template = this.getTemplate("RepeatPage"); if (!counter || !template) { app.alert("The counter field or page template is missing."); } else { var count = Number(counter.value) || 0; if (count >= 12) { app.alert("The maximum of 12 pages has been added."); } else { var pageIndex = this.numPages; template.spawn({nPage: pageIndex, bRename: true, bOverlay: false}); count++; counter.value = count; var heading = this.getField("P" + pageIndex + ".RepeatPage.Heading"); if (heading) { heading.value = "Title " + count; } else { app.alert("The new page was added, but its Heading field was not found."); } } }
Exit form editing and click Add Page repeatedly. Check that headings run from Title 1 to Title 12, that fields on different copies are independent, and that a thirteenth click shows the limit message. Save the PDF.

Work with PDF forms and Office files in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for viewing and annotating PDFs and working with Office documents. It does not configure Acrobat page-template spawning, but its format support can help you move everyday document work between applications.

Frequently Asked Questions
Why do the copied pages need renamed fields?
Fields with the same name can share values. The button script uses bRename: true when spawning the template so that each copy receives distinct field names.
How can I change the twelve-page limit?
In the button's Properties > Actions, edit the JavaScript and replace 12 in the count comparison with your preferred limit. Update the alert message to match.
Why does a new page appear without its numbered heading?
Check that the template is named RepeatPage and its text field is named Heading. The script looks for the spawned field using Acrobat's renamed-field pattern, such as P1.RepeatPage.Heading.
Will the button work in a browser PDF viewer?
Not necessarily. Browser viewers may not support Acrobat JavaScript or page-template spawning. Download the PDF and test it in a supported Acrobat or Reader environment.
Can I add more form fields to each repeated page?
Yes. Add the fields to the source page in Prepare a form before creating the template. With bRename enabled, spawned copies receive separate field names.




