• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Merged PDF's ungroup bookmarks by filename.

New Here ,
May 21, 2019 May 21, 2019

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.

TOPICS
Acrobat SDK and JavaScript

Views

868

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 21, 2019 May 21, 2019

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…

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 24, 2019 May 24, 2019

Copy link to clipboard

Copied

Thanks for your reply.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 21, 2019 May 21, 2019

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();

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 24, 2019 May 24, 2019

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 24, 2019 May 24, 2019

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 24, 2019 May 24, 2019

Copy link to clipboard

Copied

LATEST

Do keep in mind that Acrobat XI has been out of support for about 5 years now…

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines