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

Bookmark children

New Here ,
Jun 03, 2016 Jun 03, 2016

Copy link to clipboard

Copied

Last week I asked for help on a script to delete non-annotated pages and immediately got help from the MVPs. The suggested fix worked perfectly but I soon realized my flawed strategy. The documents I want to process consist of two or three thousand pages, grouped with many top level bookmarks that are also named destinations. Since I search and highlight keywords and then delete pages without annots, it so happens that sometimes, a page with a top level bookmark is deleted and then leaves no link to the children pages beneath it. So, I'd like to add a condition to the script to check whether the page has children. The top level bookmarks are 7 digit numbers and the children are Page 2, page 3, and so on. The Acrobat reference says 'children' returns an array but I'm confused.  I tried the following code but then nothing gets deleted.  Thank you guys SO MUCH for the time you put in to this forum. I have learned so much from reading answers to others questions.

Capture.PNG

TOPICS
Acrobat SDK and JavaScript , Windows

Views

909
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

correct answers 1 Correct answer

Community Expert , Jun 12, 2016 Jun 12, 2016

The only way you can get the page numbers to which the bookmarks are pointing is to execute the bookmarks (using the execute method of the Bookmark object -- forget about annotations, they are not related), and then check the current page number (using the pageNum property of the Doc object).

There's no way to get a list of Named Destinations or where they are placed using JS.

Votes

Translate
LEGEND ,
Jun 03, 2016 Jun 03, 2016

Copy link to clipboard

Copied

Pages don't have children, bookmarks do. bookmarks and pages are separate, they do not own each other.

Read ad your code carefully. If there are no bookmarks if deletes all pages with no Annots. If there are bookmarks (if the bookmark root has children) nothing is deleted. I dont quite understand what you want but I think you are looking for something that is not only not automatic, but nonexistent.

Votes

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 ,
Jun 11, 2016 Jun 11, 2016

Copy link to clipboard

Copied

Ok, I'll try to better explain what I am trying to do. I have large PDF files of 3000-4000 pages (product assembly information). All pages are bookmarked. All pages have named destinations that were created from the bookmarks. Bookmarks are arranged/named by major group (7 digit number) and subgroup (page 2, page 3 etc.)  There are links on a web page that point to each major group destination.

combo2.jpg

I use this script, combined with the 'Find and Highlight' action, to find, highlight pertinent model numbers and delete pages that are not annotated. What I'm trying to do is KEEP ALL pages that are destinations for a major group(even though some may get annotated). Since you say that there is no correlation between bookmarks and pages, is there a way I could get the information that is presented in the destinations panel (destinations sorted by name and corresponding page number) so that I could remove those pages from the pageArray if they exist? or even prevent them from being pushed to the array?

Votes

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 ,
Jun 12, 2016 Jun 12, 2016

Copy link to clipboard

Copied

LATEST

The only way you can get the page numbers to which the bookmarks are pointing is to execute the bookmarks (using the execute method of the Bookmark object -- forget about annotations, they are not related), and then check the current page number (using the pageNum property of the Doc object).

There's no way to get a list of Named Destinations or where they are placed using JS.

Votes

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