Skip to main content
Inspiring
July 16, 2018
Question

Create button to toggle on off a layer created in indesing

  • July 16, 2018
  • 1 reply
  • 1773 views

Hello, I have created a indesign file which contains 4 layers, I have export it to PDF,  I want to create button in PDF with Acrobat which can on and off a layer (A), with Java script code...

Thanks...

This topic has been closed for replies.

1 reply

Inspiring
July 16, 2018

If the PDF has what Acrobat calls layers (what the PDF reference calls OCGs - Optional Content Groups), see the following tutorial: https://acrobatusers.com/tutorials/print/creating-and-using-layers-ocgs-with-acrobat-javascript

Inspiring
July 16, 2018

Can you help me with simpler way, thanks

Inspiring
July 16, 2018

The simpler way is to set up the button with a Mouse Up action that's set to: Set layer visibility

and select which layer you want to manipulate. This alone won't act as a toggle. For that, you'd either have to use JavaScript, or use two buttons, one right on top of the other, and add additional show/hide field actions, so that when one is shown, the other is hidden. One button would show the layer, and the other would hide it.