Skip to main content
Participant
July 8, 2020
Question

Hide Navigation if no bookmarks available though javascript action

I want to hide Navigation panel if there is no bookmarks are available.
I tried using create new action and execute javascript code:

function HideNavigation(bm){

	if (bm == null) {
		this.viewState = {overViewMode:1}
	}
	return;
}

HideNavigation(this.bookmarkRoot.children);

Action runs perfectly and I saved the file but once I reopen the document still it shows Navigation.
Any idea to resolve the issue ?

This topic is closed to new replies. Start a new post to keep the conversation going.

8 replies

try67
Community Expert
Community Expert
July 8, 2020

PS. Your code is unnecessarily complicated. You can replace it with this single line:

 

if (this.bookmarkRoot.children == null) this.viewState = {overViewMode:1};

Translate
Participant
July 8, 2020

Yes, That I can update once I get concrete soultion and reason for the issue.

Translate
Bernd Alheit
Community Expert
Community Expert
July 8, 2020

You can also use

 this.pane="N";

Translate
try67
Community Expert
Community Expert
July 8, 2020

Where did you place the code, exactly?

Translate
Participant
July 8, 2020

In Adobe acrobat pro I created a action and by using option 'Exceute Javascript' I have added code in that.

 

Translate
try67
Community Expert
Community Expert
July 8, 2020

Actions only execute when you, well, execute them... If you want the code to run when the file is opened you have to embed it in it. Go to Tools - JavaScript - Document JavaScripts and place your code there.

Translate