How to Use Spawned PDF Form Pages in Adobe Reader
Question details
The user wants to know how to spawn dynamic PDF form pages using JavaScript templates in Adobe Reader, understand device compatibility, and script the removal of generated pages.

- Product
- Adobe Acrobat Reader
- Device & OS
- Windows, macOS
- Scenario
- Creating a dynamic PDF form with templates that spawn new pages based on user interaction across an organization with varied viewer versions.
- Observed behavior
- Needs a reliable method to spawn pages via script, remove them if unwanted, and ensure functionality across different PDF readers deployed in a company environment.
Before deploying dynamic PDF forms using JavaScript, ensure you test the completed document on the exact versions of Adobe Acrobat Reader used by your organization, as some reader extensions may restrict script execution.
Spawn and Remove PDF Pages Using Acrobat JavaScript
Use Acrobat JavaScript to spawn a template page dynamically and provide an option for users to delete it if the generated form is no longer needed.
Recent desktop versions of Adobe Acrobat Reader on Windows and macOS can usually execute spawned page templates without requiring special Reader-enabling rights. However, functionality heavily depends on the specific PDF viewer being used.
To spawn a template, bind a JavaScript action to a form button or event using the code: var a = this.getTemplate('Template Name'); a.spawn();
Before you can delete a spawned page, you must identify its 0-based page index. You can configure the spawned page to capture its own page number upon creation.
Add a button to the spawned page that allows the user to undo the action. Use the delete method: this.deletePages({nStart: pageNumber, nEnd: pageNumber}); to remove it.
Manage Standard PDF Forms and Pages with WPS Office
While advanced JavaScript templates can cause compatibility issues across different PDF viewers, WPS Office provides a robust, user-friendly toolset to insert pages, create standard interactive forms, and manage PDF documents without relying on complex scripting.
- 1. Open Your PDF in WPS Office: Launch WPS Office and open your PDF document using the built-in WPS PDF editor.
- 2. Access Page Management Tools: Navigate to the 'Page' tab on the top ribbon to view all pages in your document as a visual grid.
- 3. Insert or Delete Pages Manually: Click 'Insert Page' to add new form sections, or select unwanted pages and click 'Delete Pages' to remove them instantly, bypassing script limitations.

Frequently Asked Questions
Why doesn't my spawned PDF form work on mobile devices or web browsers?
Mobile PDF viewers (including those on iOS and Android), Chromebooks, and built-in web browser viewers typically do not support advanced Acrobat JavaScript like page-spawning templates. For true universal access, you should use an HTML-based form instead.
Do I need Adobe Reader extensions enabled to spawn pages?
Recent desktop versions of Adobe Acrobat Reader on Windows and macOS can often execute spawned page templates without requiring special Reader-enabling rights, but you should thoroughly test the file on your organization's specific software versions.
Can I write a script that forces a PDF form to open only in Adobe Reader?
No, you cannot use an internal PDF script to force a user's computer to launch a specific application. The default PDF viewer is strictly controlled by the user's operating system settings and application defaults.
How can a user undo or remove a spawned page they generated by mistake?
You can add a button to the generated page that runs a deletion script. By using the command this.deletePages({nStart: pageNumber, nEnd: pageNumber});, the user can successfully remove the page, provided the script accurately references the correct page index.




