Identify if bookmark is an even page

Feb 26, 2018

Copy link to clipboard

Copied

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

Views

106

Likes

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

Identify if bookmark is an even page

Feb 26, 2018

Copy link to clipboard

Copied

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

Views

107

Likes

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
Feb 26, 2018 0
Adobe Community Professional ,
Feb 26, 2018

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Feb 26, 2018 0
Feb 26, 2018

Copy link to clipboard

Copied

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

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

Likes

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
Reply
Loading...
Feb 26, 2018 0
Most Valuable Participant ,
Feb 26, 2018

Copy link to clipboard

Copied

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.

Likes

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
Reply
Loading...
Feb 26, 2018 0
Feb 26, 2018

Copy link to clipboard

Copied

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.

Likes

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
Reply
Loading...
Feb 26, 2018 0
try67 LATEST
Most Valuable Participant ,
Feb 26, 2018

Copy link to clipboard

Copied

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.

Likes

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
Reply
Loading...
Feb 26, 2018 0