Skip to main content
This topic is closed to new replies. Start a new post to keep the conversation going.

5 replies

try67
Community Expert
Community Expert
February 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
Participant
February 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
try67
Community Expert
Community Expert
February 26, 2018

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
Inspiring
February 26, 2018

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

Translate
Participant
February 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