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

Identify if bookmark is an even page

New Here ,
Feb 26, 2018 Feb 26, 2018

Forum,

I'm looking for assistant building a script to determine if a bookmark is an even page.

If true, insert a blank letter before it.

If False, do nothing.

Thank you for any leads, I'm using Acrobat Pro 11 on windows 7.

TOPICS
Acrobat SDK and JavaScript , Windows
307
Translate
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 ,
Feb 26, 2018 Feb 26, 2018

When you say "insert a blank letter before it", does "it" refer to the bookmark name, or something else?

Translate
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 ,
Feb 26, 2018 Feb 26, 2018

It refers to insert a blank letter page before the bookmark.

The end result is that every bookmark is an odd page.

Translate
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 ,
Feb 26, 2018 Feb 26, 2018

There are various issues with this.

1) Not all bookmarks necessarily point to a page.

2) Even if you assume that they do, once you insert a page into the file, all the pages after it change their page number and the pages that were odd will now become event, and vice versa.

3) To solve #2 you can process the bookmarks tree backwards, but there's also no guarantee that the order of the bookmarks corresponds to the order of the pages they point to (if they point to a page at all, see #1).

In short, this is a complex and tricky task.

Translate
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 ,
Feb 26, 2018 Feb 26, 2018

Responses in bold:

1) Not all bookmarks necessarily point to a page.

My documents have only parent bookmarks, and every bookmark links to a page.

2) Even if you assume that they do, once you insert a page into the file, all the pages after it change their page number and the pages that were odd will now become event, and vice versa.

My current workflow is to click on a bookmark from the start of the document, insert a blank page if it is an even page as necessary and move towards the end.

3) To solve #2 you can process the bookmarks tree backwards, but there's also no guarantee that the order of the bookmarks corresponds to the order of the pages they point to (if they point to a page at all, see #1).

In short, this is a complex and tricky task.

I agree.

Translate
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 ,
Feb 26, 2018 Feb 26, 2018
LATEST

OK. You would need to create a look that iterates over the bookmarks tree and call the execute method on each item in it.

Then examine the pageNum property of the Document object and if it's an odd number (remember that page numbers are zero-based) then use the newPage command to add a new page to the file.

Translate
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