Copy link to clipboard
Copied
I want to modify the book marks in my pdf. How can I write a code in JSCript for that ?
For example when I Ctrl + J and try to run this code:
var bkm = this.bookmarkRoot.children[0];
console.println( "Top-level bookmark name: " + bkm.name );
It says :
ReferenceError: bkm is not defined
1:Console:Exec
undefined
Thanks for your kind assistance.
Message was edited by: JSM (Discussion successfully moved from The Lounge to Editing & Exporting PDFs)
You need to select (with the mouse or the keyboard) the entire code before
executing it.
On Sun, Apr 2, 2017 at 12:18 PM, Just Shoot Me <forums_noreply@adobe.com>
Copy link to clipboard
Copied
You need to select (with the mouse or the keyboard) the entire code before
executing it.
On Sun, Apr 2, 2017 at 12:18 PM, Just Shoot Me <forums_noreply@adobe.com>
Copy link to clipboard
Copied
Sometimes when I select the entire code and press enter it executes and some time with the same code, the code just disappears ?
Any idea why this is happening ?
Copy link to clipboard
Copied
Not really, no... What code are you executing? What key are you pressing?
Copy link to clipboard
Copied
... and, are you using a Mac or a Windows system?
This tutorial explains which keys to press in order to execute code in the console window: https://acrobatusers.com/tutorials/javascript_console
Copy link to clipboard
Copied
Ok. Yes. I mananged that some how. But some how this code does not work. Any idea why ?
function ZBookmark(bkm, nLevel)
{
for (var i = 0; i < nLevel; i++);
bkm.zoom = 1;
if (bkm.children != null)
for (var i = 0; i < bkm.children.length; i++)
ZBookmark(bkm.children, nLevel + 1);
}
console.clear(); console.show();
console.println("Setting Zoom Level");
ZBookmar(this.bookmarkRoot, 0);
Copy link to clipboard
Copied
What makes you think that Bookmark objects have a "zoom" property?
Copy link to clipboard
Copied
The following line makes no sense:
for (var i = 0; i < nLevel; i++);
Bookmarks doesn't have a property with the name "zoom"
bkm.zoom = 1;
Copy link to clipboard
Copied
Not all bookmarks are link with go to a page view with a specific zoom.
Bookmarks can could be a link to a web page, run some custom JavaScript, open a destination, etc.
One cannot access the action associated with a specific bookmark in JavaScript so it might not be possible to add the zoom setting to a specific bookmark.
Copy link to clipboard
Copied
If what you're trying to do is change the Zoom Level associated with your bookmark then you should know it's not possible to do it with a script. It requires using a stand-alone tool (like this one I've developed: Custom-made Adobe Scripts: Batch Edit Zoom Level in Bookmarks) or possibly a plugin.