How to Add a Button to Insert a Blank PDF Form Page
Question details
The user wants to create an interactive button within a PDF that, when clicked, automatically adds a new page containing an identical, empty version of an inspection form for additional entries.

- Product
- Device & OS
- not provided
- Scenario
- Expanding an inspection form or data entry document dynamically when a user requires more space to fill out additional information.
- Observed behavior
- The user needs to set up a hidden page template and a JavaScript-enabled button that spawns the template with uniquely named fields to prevent data overlap.
Ensure your base PDF form is fully designed with all necessary fields before creating a template, and verify that you are using a professional PDF editor that supports JavaScript and page templates.
Use a Hidden Page Template and JavaScript
Create a hidden template of your blank form and use a custom JavaScript button to spawn a new page with unique field names.
To allow users to add identical blank pages dynamically, you need to turn your base form page into a hidden Page Template. Then, you can use a JavaScript function attached to a button to duplicate (spawn) this template whenever needed.
It is crucial to configure the spawn function to rename the fields on the newly created page. If the fields are not renamed, typing data into the new page will automatically mirror the exact same data onto the original page.
Open your PDF editor (such as Acrobat Pro DC) and search for 'Page Template' in the tool search box. Create a new template from your blank form page, name it (e.g., 'InspectionForm'), and set it as hidden so it doesn't display until requested.
Navigate to the form editing tools and add a new 'Button' field to your document. Place it where you want users to click to add the new page.
Right-click the button and select 'Properties'. Go to the 'Actions' tab, choose 'Mouse Up' as the trigger, and select 'Run a JavaScript' as the action. Click 'Add'.
In the JavaScript editor, enter the spawn command referencing your template name. For example: this.getTemplate('InspectionForm').spawn({nPage: this.numPages, bRename: true, bOverlay: false});
If you have existing calculation scripts that reference specific field names, update them so they correctly identify and calculate the newly renamed fields on every spawned page.

Edit and Manage PDF Forms Easily with WPS Office
WPS Office provides a comprehensive, built-in PDF editor that makes it easy to organize pages, fill out forms, and manage PDF documents without the need for heavy or expensive software.
- 1. Open your PDF: Launch WPS Office and open your PDF form document.
- 2. Access PDF Tools: Navigate to the 'Edit' or 'Page' tab to access powerful tools for inserting or organizing pages.
- 3. Insert Blank Pages: Use the 'Insert Page' feature to manually add blank pages to your document whenever additional form entries are required.
- 4. Save Changes: Click 'Save' to ensure your newly added pages and form entries are securely stored.

Frequently Asked Questions
Why does data typed on the new page appear on the first page as well?
This happens when the form fields on the newly spawned page share the exact same names as the fields on the original page. To fix this, ensure the 'bRename' property is set to 'true' in your spawn JavaScript so each new field is given a unique identifier.
Can I hide the page template so it doesn't print by default?
Yes. When you configure the Page Template in your PDF editor, there is an option to make the template hidden or invisible. A hidden template will not be visible to the user or included in printing until the JavaScript button is clicked to spawn it.
Will this JavaScript button work in all PDF viewers?
No. Advanced JavaScript functions, such as spawning page templates, require fully featured desktop PDF editors or viewers like Adobe Acrobat or WPS Office. Basic mobile PDF readers or web browser PDF plugins often do not support these advanced interactive scripts.




