Copy link to clipboard
Copied
Hi All,
I need to merge the bookmarks as well under one parent root. Right now it puts bookmarks below the filenames of the merged documents. I am using InsertPages API to merge the pdf's. Any inputs will be appreciated.
Copy link to clipboard
Copied
That is how the InsertPages feature works.
However, assuming you are using the C/C++ APIs, can then manipulate the bookmarks after insertion…
Copy link to clipboard
Copied
Thanks for your reply.
Copy link to clipboard
Copied
This is pretty easy with a script. You could do something similar with the outline structure, but this is easier.
var bkRoot = this.bookmarkRoot
var nTop = bkRoot.children.length
var bkList = [];
// Collect all 2nd Level bookmarks
for(i=0;i<nTop;i++)
bkList = bkList.concat(bkRoot.children.children);
//Now insert 2nd level into top level
for(i=0;i<bkList.length;i++)
bkRoot.insertChild(bkList,i);
var nLen = bkRoot.children.length;
// Remove old top level
for(i=nLen-1 ;i>=nLen -nTop ;i--)
bkRoot.children.remove();
Copy link to clipboard
Copied
Thank you so much for the code. I am looking for VBScript code.
Also does this work with Acrobat Professional XI. My machine has Adobe Acrobat Professional XI. I was trying to run this code and it was throwing me error object not found. Not sure if it is missing any reference? Can you please tell what DLL this requires.
Any help will be appreciated.
Copy link to clipboard
Copied
Run the code in the JavaScript console, to test and debug it. This is not VB code. Once you have it working you can work on how to call JavaScript from VB, but learn JavaScript basics first.
Copy link to clipboard
Copied
Do keep in mind that Acrobat XI has been out of support for about 5 years now…