Copy link to clipboard
Copied
I made an interactive pdf by creating buttons to set layer visibility on and off on hovering. Now I want to replace the 'base/background' pdf (because my client wanted to change 2 words...) while preserving the interactive buttons. This should work (Organize pages --> Replace with new 'base' pdf file) but it doesn't: buttons remain but the actions aren't working anymore.
The original file is made in Illustrator --> save as PDF --> Create acrobat layers from top-level layers. Names of the layers are exactly the same; only the base layer changed.
Please help?
Copy link to clipboard
Copied
Are you sure the layers are still there after you replace the pages? Do you see them in the Layers panel?
Copy link to clipboard
Copied
Definitely: the layers are there; the buttons are there (with the same action settings); the button just doesn't work... (when hovering, the 'hand' appears but no other layer is shown)
Copy link to clipboard
Copied
I guess this is because you're using the "Show/Hide layer" action.
You should use a JavaScript instead.
Copy link to clipboard
Copied
Please tell me how I do that...?
(I don't know JavaScript) (and it should work in Acrobat - for those of us who don't know JavaScript...)
Copy link to clipboard
Copied
To show a specific layer ("MyLayer1", in this example) you can use this code:
var ocgArray = this.getOCGs();
if (ocgArray!=null) {
for (var i=0; i<ocgArray.length; i++) {
if (ocgArray[i].name=="MyLayer1") {
ocgArray[i].state=true;
break;
}
}
}
To hide it replace true with false in line #5. If you need to do this multiple times it's of course possible to place this code in a generic doc-level function where you specify the layer name and new state (hidden / visible) as input parameters and just call it each time.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now