Skip to main content
Participant
Feb 4, 2025 11:29 AM UTC
Answered

Interactive button to show and hide layers

Hello! I am hoping someone can help me please with interactive buttons!

 

I have created a map that has different layers for each service we have in that area  - all created in Indesign. The final aim is to have an interactive PDF. 

 

I wanted the user to be able to click a button in a key to show a layer/ particular service and unclick it to turn it off if needed. 

 

How do I do this? I have tried creating buttons but can't see an easy way to show layers as an action?

Jeffrey_SmithCorrect answer
Community Expert
Feb 5, 2025 3:13 PM UTC

There is a workaround method that uses two buttons (placed over top of each other).

1. first button shows the map, shows the hide button, hides itself.

2. then the second button hides the map, shows the first button, hides itself.

Files are attached to demonstrate

7 replies

Robert at ID-Tasker
Legend
Feb 5, 2025 2:07 PM UTC

It's be possible - but would require injecting JavaScript in Acrobat. 

 

Translate
TᴀW
Legend
Feb 4, 2025 12:01 PM UTC

It should be possible. You need to create a button in InDesign, then add an action ("Show/hide buttons and forms"), and you get this:

 

Translate
id-extras.com | InDesign tools & scripts for typesetters, form designers, and translators
Participant
Feb 4, 2025 12:32 PM UTC

Thank you - so I created a box and made it a check box button, you can click it and it will show the layers but do you know how I get it to hide them again when the box/button is unclicked?

Translate
TᴀW
Legend
Feb 5, 2025 12:37 PM UTC

That's a good question. I was playing around with it a little and I'm not sure.

All I can think of (untested) is to create two superimposed checkboxes. Clicking on one causes it to hide itself and show the other, and vice versa. That way you provide different visibility configurations for each checkbox.

But I think what Adobe intended (if they intended anything at all), or, at least, the simplest option, is to create two buttons side by side. One should be labelled "Show Map" (or whatever it is you're showing), and the other "Hide Map". At that point it is easy to show and hide layers depending on which button has been clicked.

Translate
id-extras.com | InDesign tools & scripts for typesetters, form designers, and translators