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.
Copy link to clipboard
Copied
When you say "insert a blank letter before it", does "it" refer to the bookmark name, or something else?
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.
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.
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.
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.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now