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

Interactive pdf for maps

New Here ,
May 21, 2024 May 21, 2024

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.

TOPICS
Edit and convert PDFs
503
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 ,
May 21, 2024 May 21, 2024

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.

 

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
New Here ,
May 21, 2024 May 21, 2024
LATEST

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;
}
}

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