Skip to main content
Participant
July 8, 2020
Question

Hide Navigation if no bookmarks available though javascript action

  • July 8, 2020
  • 2 replies
  • 483 views

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 has been closed for replies.

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

Participant
July 8, 2020

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

Bernd Alheit
Community Expert
Community Expert
July 8, 2020

You can also use

 this.pane="N";

try67
Community Expert
Community Expert
July 8, 2020

Where did you place the code, exactly?

Participant
July 8, 2020

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

 

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.