How to Test Acrobat PDF Templates Without Deleting Them
Question details
The user wants to test a PDF form's page-deletion script without it accidentally removing the visible template page.
- Product
- Adobe Acrobat PDF
- Device & OS
- not provided
- Scenario
- Editing and testing a PDF form that utilizes hidden templates to spawn pages, where a reset button is configured to delete pages from page 12 onward.
- Observed behavior
- When the template is made visible for editing, the reset button's script treats the template as a standard document page and inadvertently deletes it alongside the spawned pages.
Verify the exact name or index of your template page and review the page range defined in your reset button's deletePages script.
Add a Visibility Condition to Your Deletion Script
Modify your JavaScript to verify whether the template page is hidden before executing the deletion command, effectively skipping the template.
Since Acrobat treats a visible template as a real, standard document page, any script configured to delete pages within its index range will remove it. Adding a logical condition ensures the script distinguishes between spawned pages and the actual template.
Right-click your reset button in Form Editing mode, select 'Properties', and navigate to the 'Actions' tab.
Select your existing 'Run a JavaScript' action and click 'Edit' to open the JavaScript editor.
Add an 'if' statement around your delete script that checks the template's visibility state. Alternatively, update the script to hide the template page instead of deleting it if the condition matches the template's properties.
Click 'OK' to save the script. Test the reset button to confirm that spawned pages are deleted while the template remains intact.

Create a Temporary Visibility Toggle Button
Add a temporary testing button to manually toggle the template's hidden status, ensuring it remains hidden while you test the reset button.
Manage PDF Pages and Forms Easily with WPS Office
WPS Office offers an intuitive PDF editor that lets you seamlessly manage pages, create fillable forms, and edit document structures without needing complex JavaScript configurations.
- 1. Open your PDF file: Launch WPS Office and open your PDF document containing the forms or pages you want to edit.
- 2. Navigate to the Page tab: Click on the 'Page' tab on the top toolbar to access intuitive tools for deleting, inserting, or replacing pages visually.
- 3. Use Form tools: Switch to the 'Form' tab to securely add, edit, or adjust form fields without worrying about backend scripting errors.

Frequently Asked Questions
Why does my reset script delete the template page?
When a PDF template is made visible, Adobe Acrobat treats it as a standard, active document page. If your JavaScript is programmed to delete a range of pages that happens to include the visible template's page index, the template will be deleted.
How do I hide a PDF template in Acrobat?
You can hide a PDF template by opening the 'Organize Pages' or 'Page Thumbnails' panel, selecting the template page, right-clicking to access Page Properties, and setting it to hidden. Alternatively, you can run a one-line JavaScript command to set the template's hidden property to true.
Can I recover a template page if it was accidentally deleted?
If you have not yet saved and closed the document, you can recover the deleted template by using the 'Undo' function (Ctrl+Z) or by choosing 'File' > 'Revert' to restore the last saved version of your PDF.
What is a spawned page in PDF forms?
A spawned page is a new page dynamically generated within a PDF document from a hidden template page using JavaScript. This allows users to add multiple pages of the same form structure as needed.




