Generate Bookmarks from Page Text

Please post any ideas or requests for new features here for the End User Version of PDF-XChange (printer Drivers)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange, Tracker - Clarion Support, John - Tracker Supp, Support Staff, moderators

Nemo
User
Posts: 84
Joined: Mon Apr 20, 2020 12:23 pm

Generate Bookmarks from Page Text

Post by Nemo »

When you use a text matching pattern it seems only to generate a single bookmark per page even if there are multiple matches on the page.

For example with a pattern of [A-Z][A-Z][A-Z][0-9]+ on a page containing ABC12 DEF3 GHY87 it generates only a bookmark for ABC12 when I would like it to generate three bookmarks
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19917
Joined: Mon Jan 12, 2009 8:07 am

Re: Generate Bookmarks from Page Text

Post by Stefan - PDF-XChange »

Hello Nemo,

I've asked a colleague in the dev team to take a look!
When I specify a whole word (e.g. "test") instead of a regular expression - all instances of this word are found and a bookmark created for each. So this might be specific to RegEx. I will know more once my colleague has looked at it, and we will post additional info here.

Kind regards,
Stefan
Willy Van Nuffel
User
Posts: 2772
Joined: Wed Jan 18, 2006 12:10 pm

Re: Generate Bookmarks from Page Text

Post by Willy Van Nuffel »

Maybe a problem with the proximity (neighborhood) of the words (see attached PDF)?
The first page is treated correctly, the second page is not.

De-activating the "Edit Text Elements as Blocks"-option in Edit > Text, does not seem to help.

I do not see any other option in the "Generate Bookmarks From Page Text"-dialog-box that might help.

Is it possible to work around the problem by using font name / font size / text color / text case distinction?
You do not have the required permissions to view the files attached to this post.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19917
Joined: Mon Jan 12, 2009 8:07 am

Re: Generate Bookmarks from Page Text

Post by Stefan - PDF-XChange »

Hello Willy Van Nuffel, Nemo,

I actually got it to work with this expression
[A-Z]{3}[0-9]+

Which should give identical matches:
[match an uppercase letter]{exactly three times}[match a single digit] match the previous, the single digit, one or more times (the + symbol).
And this worked perfectly fine for me.

Kind regards,
Stefan
Nemo
User
Posts: 84
Joined: Mon Apr 20, 2020 12:23 pm

Re: Generate Bookmarks from Page Text

Post by Nemo »

I've tried [A-Z]{3}[0-9]+ but it doesn't work for me, unfortunately.
Willy Van Nuffel
User
Posts: 2772
Joined: Wed Jan 18, 2006 12:10 pm

Re: Generate Bookmarks from Page Text

Post by Willy Van Nuffel »

The expression proposed by Stefan [A-Z]{3}[0-9]+ also works for me in the example PDF here above.

@Nemo
Can you post an example PDF from your side, where you can not generate the bookmarks in the correct way?

Thanks.

Willy.
Nemo
User
Posts: 84
Joined: Mon Apr 20, 2020 12:23 pm

Re: Generate Bookmarks from Page Text

Post by Nemo »

Willy,

In your example PDF the three items of text are on three different lines. In my example they are on the same line.

Does it work for you if they are on the same line?
Willy Van Nuffel
User
Posts: 2772
Joined: Wed Jan 18, 2006 12:10 pm

Re: Generate Bookmarks from Page Text

Post by Willy Van Nuffel »

When the three items are on the same line, it does not work at all (at least for me). No bookmarks are generated.

I am afraid that in the current state of the bookmarks feature, it will not be possible to achieve what you like.
It only seems to work line by line. I suppose you have pages with three columns of text or something alike?

Best regards.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19917
Joined: Mon Jan 12, 2009 8:07 am

Re: Generate Bookmarks from Page Text

Post by Stefan - PDF-XChange »

Hello Willy, Nemo,

Provided these are white spaces after each of your strings - I managed to get this to work even when they are on the same line:
[A-Z]{3}[0-9]+\s
image.png
Kind regards,
Stefan
You do not have the required permissions to view the files attached to this post.
Nemo
User
Posts: 84
Joined: Mon Apr 20, 2020 12:23 pm

Re: Generate Bookmarks from Page Text

Post by Nemo »

Thank you Stefan

That works for me too. I'm not sure why it should be necessary specify the spaces but for my immediate requirements that works.
Willy Van Nuffel
User
Posts: 2772
Joined: Wed Jan 18, 2006 12:10 pm

Re: Generate Bookmarks from Page Text

Post by Willy Van Nuffel »

Thanks Stefan, that is good news for Nemo.

Unfortunately, in my example document this is still not fully working.
Only the first two items are bookmarked, not the third one.
But this is not a problem for me. I only used this feature now for test purposes.

Kind regards.

Willy
You do not have the required permissions to view the files attached to this post.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19917
Joined: Mon Jan 12, 2009 8:07 am

Re: Generate Bookmarks from Page Text

Post by Stefan - PDF-XChange »

Hello Willy Van Nuffel,

My latest RegEx is looking for a white-space character after the numbers, so if your example had no space after the last entry - it will not match it.

Kind regards,
Stefan