How to Create New PDF Form Pages with Predefined Fillable Fields
Question details
The user wants to allow document recipients to dynamically generate new pages (such as incident reports) containing predefined fillable form fields without creating multiple duplicate pages in advance.

- Product
- PDF Editor
- Device & OS
- not provided
- Scenario
- Creating advanced, interactive fillable PDF forms where users need to add additional pages on demand.
- Observed behavior
- The goal is to automatically spawn new pages from a template containing exact predefined form fields, triggered by user interaction.
Ensure you are using a professional PDF editor with advanced form creation capabilities and that JavaScript execution is enabled in your PDF viewer.
Use Template Objects and JavaScript to Spawn Pages
This method involves creating a hidden template page within the PDF and using a JavaScript-enabled button to let users generate new pages from that template dynamically.
By turning a designed page into a Template Object, the PDF engine stores its layout and form fields. A simple JavaScript action can then be tied to a button, instructing the PDF to 'spawn' a fresh copy of that template whenever clicked, preventing unnecessary bloat in your document.
Design your initial page (e.g., the incident report) with all necessary predefined fillable fields. Ensure all text boxes, checkboxes, and labels are positioned correctly.
In your advanced PDF editor (like Adobe Acrobat), go to 'Organize Pages' or the 'Prepare Form' tool. Right-click the page you want to use, select 'Page Templates', name your template (e.g., 'ReportTemplate'), and set it to hidden.
Navigate to the main page of your document where users will request a new page. Insert a 'Button' form field. In the button's properties, go to the 'Actions' tab.
Set the action trigger to 'Mouse Up' and select 'Run a JavaScript'. Enter the spawn code: `this.getTemplate('ReportTemplate').spawn({nPage: event.target.page + 1, bRename: true, bOverlay: false});`. The `bRename: true` parameter ensures new fields are uniquely named to prevent form data duplication.

Easily Create and Manage Fillable PDF Forms with WPS Office
WPS Office offers intuitive and robust PDF editing tools, allowing you to easily insert text fields, checkboxes, and interactive buttons into your documents without writing complex scripts.
- 1. Open PDF in WPS Office: Launch WPS Office and open your existing PDF document or create a new one using the WPS PDF tool.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to reveal the interactive form field options.
- 3. Insert Predefined Fields: Select the 'Text Field', 'Check Box', or 'Push Button' icons, then click anywhere on your document to place them.
- 4. Duplicate Pages Easily: If you need multiple copies of the form without using JavaScript, simply go to the 'Page' tab, select your prepared page, and click 'Extract' or copy the page to quickly duplicate it before distribution.

Frequently Asked Questions
Why is the data I type on the new page appearing on the old page?
This happens when form fields across multiple pages share the exact same name. In PDFs, fields with identical names mirror each other's data. To fix this, ensure your JavaScript spawn command includes the parameter to rename fields automatically (e.g., bRename: true).
Can I spawn new PDF pages dynamically without using JavaScript?
Generally, allowing end-users to dynamically generate new pages on demand requires JavaScript. If you want to avoid scripting, you must manually duplicate the necessary pages within the PDF editor before sending the document to users.
Why is my template page set to hidden?
Template pages are typically hidden so they do not interrupt the normal flow of reading or printing the document. They act behind the scenes purely as a blueprint for the pages that get spawned.




