Copy link to clipboard
Copied
Hi there,
I'm looking for an automated solution creating Bookmarks.
My PDF is a raw document. I mean, on the first page begins the reporting for the first customer, let's say it finished to the 4th page.
Right after, on the 5th page, begins my 2nd customer, let's say it finished right here (one page for this one).
It means then, the 3rd reporting (for my 3rd customer) begins to the 6th page etc...I think you got it...
To differentiate this reportings, on each page I got on the first lines of the page "Libellé client :" follow by the name of the customer.
For example, by using my previous explanations :
page 1 : Libellé Client : NameOfTheCustomer1
page 2 : Libellé Client : NameOfTheCustomer1
page 3 : Libellé Client : NameOfTheCustomer1
page 4 : Libellé Client : NameOfTheCustomer1
page 5 : Libellé Client : NameOfTheCustomer2
page 6 : Libellé Client : NameOfTheCustomer3
etc...
It also means, all my Bookmarks are the same level (just under the root level I guess).
My customers follow each other...and I need bookmarks to navigate ASAP to a specific customer. My number of customers is around 150, it's a waste of time to manually add Bookmarks...
Sincerely,
Bleict
Copy link to clipboard
Copied
You would need to create a loop that iterates over all the words in the pages of your file looking for this marker you added ("Libellé"), and then extract the following words (up until where, by the way?), and use that for the bookmark name.
The first part can be done using getPageNthWord method of the Document object and the second part using the createChild method of the Bookmark object.
I've developed several very similar tools to this one in the past for my clients, so if you're interested I'd be happy to create it for you, for a small fee. You can contact me privately at try6767 at gmail.com to discuss it further.
Copy link to clipboard
Copied
Possible but tricky. However, since you have setup the beginning of each customer section with consistent text, it is actually fairly simple to find the beginnings of each customer section. I've written such scripts many times. Feel free to contact me about your project.