Can Dynamic PDF Bookmarks Be Shown or Hidden?
Question details
The user wants to know if PDF bookmarks can dynamically show or hide in sync with the visibility of form sections in LiveCycle dynamic PDFs.

- Product
- Device & OS
- not provided
- Scenario
- Working with LiveCycle dynamic PDFs that utilize show-and-hide form sections.
- Observed behavior
- Bookmark visibility does not automatically update or hide when the corresponding form sections change visibility.
Before modifying your PDF with document-level scripts, ensure you have saved a backup copy, as deleting or recreating bookmarks via scripting alters the document structure permanently.
Use JavaScript to Add or Delete Bookmarks
Since you cannot dynamically hide or show bookmarks natively, you must use scripting to delete and recreate them as form sections change.
Dynamic show-and-hide behavior is natively not supported for PDF bookmarks. Bookmarks cannot be reliably hidden and displayed automatically simply because a document section becomes visible.
As a workaround, you can use document-level JavaScript to actively manage the bookmark tree by deleting bookmarks when a section hides and creating new ones when the section appears.
Determine which dynamic form sections need corresponding bookmarks when they are triggered to become visible by the user.
Use JavaScript within your PDF editor to locate and execute the 'bookmark.remove()' function on the specific bookmark node when its related form section is hidden.
Add a script utilizing the 'bookmark.createChild()' method to recreate the bookmark node, pointing to the correct page or destination, when the form section is triggered to show.

Easily Add and Manage Bookmarks Manually in WPS Office
Since dynamic bookmarks cannot be automatically shown or hidden via properties, managing them manually is often the most reliable method. WPS Office provides an intuitive PDF editor to easily add, delete, and organize standard bookmarks without complex scripting.
- 1. Open the PDF: Launch WPS Office and open your target PDF document.
- 2. Access the Bookmark Panel: Click the 'Bookmark' icon located on the left navigation pane to reveal the bookmark tree.
- 3. Add a New Bookmark: Navigate to the desired page, right-click within the bookmark panel, and select 'Add Bookmark' to create a new navigation link.
- 4. Delete an Existing Bookmark: To remove a bookmark, simply right-click the existing entry in the panel and select 'Delete'.

Frequently Asked Questions
Why can't I hide a PDF bookmark without deleting it?
The core PDF specification does not support a native 'hidden' state for bookmarks. Bookmarks are structurally either present in the document's navigation tree or they are entirely removed.
Can I use JavaScript to control PDF form fields instead of bookmarks?
Yes, while bookmarks cannot be dynamically hidden, you can seamlessly use JavaScript to change the visibility of form fields, buttons, and specific document layers (Optional Content Groups) based on user interaction.
Will deleting and recreating bookmarks affect the PDF structure?
Deleting a bookmark permanently removes its specific navigational link from the tree. When you recreate it via script or manually, you must explicitly define its target page, zoom level, or destination to fully restore the original navigation structure.




