Copy link to clipboard
Copied
Hi,
I have a slight issue with making an interactive pdf file. I haven't made any before so i don't have too much knowledge about it. Simply i have a map with multiple layers exported from ArcGis Pro. I want to make an interactive pdf from this file so the reader is able press a button on the file that will turn a layer off and on. The current feature only allows me to show one layer and will turn the others off. I want the reader to turn multiple layers on and off at the same time. How can i do this?
Thanks for your help in advance.
Copy link to clipboard
Copied
You can do it using this code:
var layerToShow = "Layer1";
var ocgArray = doc.getOCGs();
for (var i=0; i<ocgArray.length; i++) {
if (ocgArray[i].name==layerToShow) {
ocgArray[i].state=!ocgArray[i].state;
break;
}
}
Edited: Removed incorrect return command.
Copy link to clipboard
Copied
Hi thanks for your quick response. I managed to make it work using the command i found from a video.
The command is the follwing:
var docOCGs = this.getOCGs();
for (var i=0; i < docOCGs.length; i++)
{
if(docOCGs[i].name == "Text")
{
docOCGs[i].state = !docOCGs[i].state;
}
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now