How to Show or Hide PDF Pages with a Button or Check Box
Question details
The user wants to dynamically hide or reveal specific pages in a seven-page examination form using a button or check box.

- Product
- PDFill and standard PDF editors
- Device & OS
- not provided
- Scenario
- Creating an interactive, multi-page PDF form where certain sections or pages only appear when triggered by a user's selection.
- Observed behavior
- Standard PDF specifications do not natively support hiding and revealing entire pages dynamically with standard form controls.
Keep in mind that the standard PDF format does not allow for hiding or revealing entire pages dynamically. You will need to use workarounds like Optional Content Groups (layers) or JavaScript to hide the content on those pages instead.
Use Optional Content Groups (Layers) to Hide Content
Instead of hiding complete pages, organize your form content into layers that can be toggled on and off using buttons.
Optional Content Groups (OCGs), commonly known as layers, allow you to control the visibility of specific elements within a PDF. While the physical blank page remains, the content itself can be hidden or revealed.
Keep in mind that layer visibility support depends heavily on the PDF viewer being used by the end user.
Open your advanced PDF editor and create an Optional Content Group (layer) for the form sections you want to hide.
Place the text, form fields, and images for the optional examination sections onto this newly created layer.
Access the properties of your check box or button, navigate to the Actions tab, and set a trigger (like 'Mouse Up') to toggle the visibility state of the specific layer.

Use JavaScript to Control Field Visibility
Write custom JavaScript to hide or show specific form fields dynamically based on a check box selection.
Edit and Manage Interactive PDF Forms with WPS Office
While dynamically hiding complete pages is limited by PDF standards, WPS Office provides a comprehensive suite of PDF tools to easily organize pages, manage form fields, and handle complex PDF documents with ease.
- 1. Open your PDF: Launch WPS Office and open your PDF form document.
- 2. Navigate to the Form tab: Click on the 'Form' tab to interact with, fill out, or highlight existing form fields.
- 3. Manage your pages: If you need to create custom versions of the form for different users, use the 'Page' tab to quickly extract or delete the pages you do not want them to see.

Frequently Asked Questions
Can I completely hide a PDF page using a standard check box?
No, the standard PDF format does not natively support removing or hiding entire pages dynamically via simple check boxes. You have to hide the content (like fields, text, or layers) on the page instead, leaving a blank page behind.
What is an Optional Content Group (OCG) in PDFs?
An OCG, commonly known as a layer, allows document authors to control the visibility of certain content within a PDF. It can be toggled on or off using buttons, JavaScript, or the viewer's layer panel.
Does JavaScript work the same across all PDF viewers?
No, JavaScript support varies significantly depending on the PDF viewer. While robust desktop software offers extensive support, many default mobile viewers or web browsers may not execute form-related JavaScript correctly.




