Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Can you help me with simpler way, thanks
Copy link to clipboard
Copied
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.