Copy link to clipboard
Copied
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 ?
Copy link to clipboard
Copied
Where did you place the code, exactly?
Copy link to clipboard
Copied
In Adobe acrobat pro I created a action and by using option 'Exceute Javascript' I have added code in that.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Yes I did executed Action and saved the file. I want this operation to execute for multiple files within same folder because of that I created Action.
Copy link to clipboard
Copied
OK, then you need to create an Action that embeds this code in the files you're running it on, not execute it directly... You can do it like this (I'm using my more simplified version of your code from below):
this.addScript("nav", "if (this.bookmarkRoot.children == null) this.viewState = {overViewMode:1};");
Don't forget to add a step to save the files, too.
Copy link to clipboard
Copied
PS. Your code is unnecessarily complicated. You can replace it with this single line:
if (this.bookmarkRoot.children == null) this.viewState = {overViewMode:1};
Copy link to clipboard
Copied
Yes, That I can update once I get concrete soultion and reason for the issue.
Copy link to clipboard
Copied
You can also use
this.pane="N";