How to Create Interactive Links Between Layers in a PDF Map
Question details
The user needs to add interactive links to a multilevel PDF map to control layer visibility or jump between different map levels.

- Product
- Device & OS
- not provided
- Scenario
- Creating an interactive multilevel map where users can click map contents to turn specific optional-content layers on and off or navigate to different map sections.
- Observed behavior
- Standard PDF hyperlinks only navigate to pages or views and do not natively support toggling optional-content layers without advanced JavaScript.
Ensure your PDF document already contains the necessary optional-content layers (OCGs) and that you are using a PDF editor capable of adding custom JavaScript actions, such as Adobe Acrobat Pro.
Use Document JavaScript to Toggle PDF Layers
Add custom JavaScript actions to PDF buttons or links to dynamically turn map layers on and off upon user clicks.
Standard PDF links are designed to navigate to pages, views, or URLs. Because layer toggling is considered advanced interactive behavior, you must use document JavaScript to programmatically alter the state of optional-content layers.
Open the multilevel PDF map in Adobe Acrobat Pro or an advanced PDF editor that supports JavaScript scripting.
Select the 'Prepare Form' tool or 'Rich Media' tool from the tools menu, and draw a Button field over the map area you want to be clickable.
Right-click the newly created button, select 'Properties', and navigate to the 'Actions' tab.
Set the 'Select Trigger' to 'Mouse Up' and 'Select Action' to 'Run a JavaScript'. Click 'Add' and enter the required script to toggle the specific layer (e.g., var layer = this.getOCGs()[0]; layer.state = !layer.state;).
Click 'OK' to save the script, close the properties window, and test the button in standard viewing mode to ensure the layer toggles correctly.

Navigate Map Levels Using Standard Links and Named Destinations
Create an alternative interactive experience using standard hyperlinks to jump to different pages or specific map views instead of toggling JavaScript layers.
Manage and View PDF Map Layers in WPS Office
While advanced JavaScript layer toggling requires specialized authoring tools, WPS PDF provides an excellent, user-friendly interface for viewing complex maps. You can easily access existing map layers, create bookmarks, and add standard hyperlinks to navigate seamlessly between different sections of your multilevel PDFs.
- 1. Open Your PDF Map: Launch WPS PDF and open your multilevel PDF map file.
- 2. Access the Layers Panel: Click the 'Layers' icon on the left navigation pane to view all available optional-content groups. Click the eye icon to manually toggle map layers on or off.
- 3. Insert Navigation Links: To add navigation links between map pages, go to the 'Insert' tab on the top ribbon and click on 'Link'.
- 4. Draw and Link: Draw the link area on your map, select 'Link to Document', and set the destination page to link another map level easily.

Frequently Asked Questions
Why aren't my PDF layer links working in mobile browsers?
Most mobile browsers and default OS PDF previewers lack support for the complex Adobe JavaScript actions required to toggle layers dynamically. For interactive scripts to work, users must open the file in a dedicated desktop PDF reader.
Can I create an interactive map without using JavaScript?
Yes. Instead of using layers on a single page, you can save each map state as a separate page in the PDF. You can then use standard hyperlinks to jump between these pages. This method is highly reliable across almost all PDF viewers.
How do I manually view existing PDF layers in a document?
In standard PDF editors like WPS PDF and Adobe Acrobat, you can reveal the left sidebar and click on the 'Layers' icon. This opens a panel listing all document layers, allowing you to manually click the visibility (eye) icon to turn them on or off.




