Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
22

Interactivity (buttons setting layer visibility) is not preserved when replacing page in Acrobat

Explorer ,
Mar 08, 2024 Mar 08, 2024

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?

TOPICS
Edit and convert PDFs , PDF , PDF forms
956
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 08, 2024 Mar 08, 2024

Are you sure the layers are still there after you replace the pages? Do you see them in the Layers panel?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 11, 2024 Mar 11, 2024

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)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 09, 2024 Mar 09, 2024

I guess this is because you're using the "Show/Hide layer" action.

You should use a JavaScript instead.


Acrobate du PDF, InDesigner et Photoshopographe
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 11, 2024 Mar 11, 2024

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...)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 11, 2024 Mar 11, 2024
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines