How to Let Users Duplicate a Page in an Interactive PDF Form
Question details
The user wants to provide a button in an interactive PDF form that allows end-users to duplicate a specific page (like a repeatable form section) without modifying the main document structure.

- Product
- PDF Editor
- Device & OS
- not provided
- Scenario
- Creating advanced interactive PDF forms with repeatable sections.
- Observed behavior
- Needs a method to spawn new template pages dynamically using a form button and JavaScript.
Ensure you have a professional PDF editor with form creation and JavaScript execution capabilities, and verify that your document is not restricted by security passwords.
Use Template Objects and JavaScript to Duplicate Pages
This method allows users to click a button to spawn a new copy of a hidden template page within the PDF form.
To accomplish this, you must define the target page as a 'Template' and then assign a custom JavaScript action to a form button.
Open your PDF form in your advanced PDF editor and navigate to the page organization tools.
Select the page you want to duplicate, find the 'Page Templates' option, name the template (e.g., 'RepeatPage'), and set it to be hidden.
Switch to the form editing mode and insert a 'Button' field into your document where users can easily click it.
Right-click the newly added button, select 'Properties', and go to the 'Actions' tab.
Set the 'Select Action' dropdown to 'Run a JavaScript' (or equivalent) and click 'Add'.
Enter the script to spawn the page, such as: var expTplt = getTemplate('RepeatPage'); expTplt.spawn({nPage: pageNum, bRename: true, bOverlay: false}); and save your changes.

Edit PDFs and Forms Easily with WPS Office
While advanced JavaScript page spawning requires complex configuration in heavy software, WPS Office provides a lightweight, highly compatible alternative for everyday PDF editing, form filling, and document management.

Frequently Asked Questions
Why does the duplicated page share the same data as the original?
If the form fields on the duplicated page have the exact same names as the original, the data will mirror across both pages. You must ensure your JavaScript renames the fields upon spawning by setting the bRename parameter to true.
Can users duplicate pages in a free PDF reader?
Yes, free PDF readers can usually execute the JavaScript attached to the button to spawn the page, provided the PDF form was created properly and saved with extended reader rights.
How do I allow users to delete a spawned page?
You would need to add another button with a JavaScript action designed to delete the spawned page using the deletePages() method, targeting the specific page number of the duplicated section.




