Page 1 of 1

Locate Bookmark (page) and insert blank page if page number is even

Posted: Tue Jan 07, 2025 4:46 pm
by Barnie
Hi guys :-)

Recently I was happy to find the new bookmarks features, but as they are I think there are further helpful consecutive actions needed.

In this case I'd like to locate all bookmarked pages , check if they are even or odd ones and in case of even, I need to insert a blank page.
The intent is obvious: Making sure the new chapter (bookmark) will start on a right handed page / new page.

I tried to combine the bookmark action [select page by bookmark] AND [Select even pages] followed by [Add page] ...

That doesn't work overall like that - the first page selected works fine, afterwards it puts blank pages "at random" or not:-)
(but I must admit, I didn't use a lot operators and/or/not til now)
My guess: The odd/even positions are not available consecutively but only at one first instant, and thereafter the decision where to insert is kept although the insertion several pages before may alter the pages later on at runtime (?)

Re: Locate Bookmark (page) and insert blank page if page number is even

Posted: Wed Jan 08, 2025 11:11 am
by freddyp
The order of the actions in your action list is incorrect. The operators AND/OR/NOT have to come AFTER the operands. The correct order is:
Select pages with bookmarks
Select even pages
AND
Add pages

Do your documents only have top-level bookmarks, or do they form a tree structure. If the latter, it will not work correctly.

Do you have Switch? Is it OK if the final result is correct, but the bookmarks are lost?

Re: Locate Bookmark (page) and insert blank page if page number is even

Posted: Wed Jan 08, 2025 1:10 pm
by Barnie
Hi freddyp

and thanks for the quick response.
Actually I wasn't too precise in describing the routine's order....
The AND operator surely followed the two operands exactly as you stated here.

But yeah, there is a tree-structure below level1 bookmarks.
As I merged all the PDFs I used a known prefix to all the resulting top-level bookmarks in order to identify those. (Select pages with bookmarks optionally matching Name: "54321" )
It doesn't actually match, as it's only a part of the bookmark name. I guess that is the error and the bookmark tree below as well.

So, thank you ! Good to know what I don't know :D
I'll be testing with proper data once more (soon)

PS: No , we don't use Switch by now

Re: Locate Bookmark (page) and insert blank page if page number is even

Posted: Wed Jan 08, 2025 5:16 pm
by Terkelsen
You have an option to use regular expressions to define the names. That might help to match all the names.

Re: Locate Bookmark (page) and insert blank page if page number is even

Posted: Thu Jan 09, 2025 11:39 am
by freddyp
(Select pages with bookmarks optionally matching Name: "54321" )
If all your top-level bookmarks start with 54321 and the lower-level do not, then you indeed have a way of filtering only the top-level ones. However, it is not with 54321 as a regular expression that it will work, but with 54321.+ meaning 54321 followed by any character one or multiple times. The regular expression has to match the whole string. As the 54321 is not likely to be fixed, the regex could be something like \d{5}\s.+ which means 5 digits followed by a space followed by one more characters (as the people who attended the January 2025 workshop held by Loïc yesterday will know :D).