How to Hide a PDF Form Page and Show It With a Button
Question details
The user wants to hide an additional PDF page containing unique form fields and only reveal it when a user clicks a specific button within the document.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form with expandable behavior, specifically attempting to hide and show pages dynamically after recreating a protected LiveCycle document.
- Observed behavior
- The form needs a reliable mechanism, such as Acrobat JavaScript, to keep a template page hidden and spawn or reveal it upon a button click depending on the reader's software.
Verify the exact version of Adobe Acrobat you are using (Pro or Standard) and determine whether your end-users will view the form in Acrobat or the free Adobe Reader, as this determines your JavaScript execution rights.
Spawn a Hidden Template Using Acrobat JavaScript
Convert the target page into a hidden template and use JavaScript attached to a button to spawn the page dynamically when clicked.
This method requires Adobe Acrobat Pro to create the page templates. By creating a hidden template, you can assign a JavaScript action to a button that will duplicate (spawn) the page dynamically when the user requests it. This is the standard workaround for recreating expanding XFA (LiveCycle) behaviors in Acroforms.
Open your PDF in Acrobat Pro, navigate to the 'Organize Pages' tool, select the page you want to hide, and click 'More' > 'Page Templates'. Enter a name for your template and click 'Add'.
In the Page Templates dialog, ensure the visibility icon (the eye symbol) next to your newly created template is toggled off. This ensures the page remains hidden by default when the document is opened.
Switch to the 'Prepare Form' tool. Add a Button field to the page where you want the trigger to be, right-click the button, and select 'Properties'.
In the Button Properties menu, go to the 'Actions' tab. Select 'Mouse Up' as the trigger, choose 'Run a JavaScript' from the 'Select Action' dropdown, and click the 'Add' button.
In the JavaScript Editor, enter the script: `this.getTemplate("YourTemplateName").spawn({nPage: this.numPages, bRename: true});` (replace 'YourTemplateName' with the actual template name). Click 'OK' to save.

Create and Manage Interactive PDF Forms with WPS Office
While advanced JavaScript spawning requires specialized development tools, WPS Office provides a comprehensive, user-friendly suite for creating, editing, and managing standard PDF forms seamlessly.
- 1. Open Your PDF in WPS: Launch WPS Office and open your target PDF document using the WPS PDF editor.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to access the interactive form controls and editing features.
- 3. Add Form Fields: Click on 'Text Field', 'Check Box', or 'Push Button', then click and drag on the document page to place your new form elements.
- 4. Customize Field Properties: Double-click any newly added form field to open the properties panel, where you can customize its name, appearance, and specific interactive actions.

Frequently Asked Questions
Can I hide a PDF page dynamically without using JavaScript?
No, standard Acroform PDFs do not support dynamic page visibility out of the box. To change page visibility or spawn pages on the fly based on user interaction, you must use Acrobat JavaScript and template features.
Will the 'Show Page' button work in standard Adobe Reader?
Yes, a button that spawns a template using JavaScript will work in the free version of Adobe Reader, but only if the document creator has enabled 'Reader Extended Rights' (Save As Other > Reader Extended PDF) in Acrobat Pro.
How do I make the spawned form fields unique?
When spawning a template via JavaScript, pass the parameter `bRename: true` (for example: `this.getTemplate("Name").spawn({nPage: 1, bRename: true})`). This ensures the newly generated form fields are uniquely named and do not duplicate data entered on other pages.
Why did my expanding form break when recreating a LiveCycle document in Acrobat?
LiveCycle uses an XML-based architecture (XFA) designed specifically for dynamic, flowable forms. Standard Acrobat forms (Acroforms) use a static architecture. To mimic expanding behavior in Acroforms, you have to rebuild the functionality manually using JavaScript to spawn hidden templates.




