user2801023
user2801023

Reputation: 497

How to add URL to PDFs with searchable text in python?

I have several PDF files of scanned old books with searchable text. I'd like to add links to texts matching a pattern. Here are the logical steps:

1 - Find pattern; 2 - Get the position of the text; 3 - Add a link to the text in that position.

For example, every time I find a number with more than 4 digits, I add a link (square around the text) to a website (in latex I'd simple replace "123123" with "\href{google.com}{123123}". Do you have any idea on how to do that in python or other languages?

Upvotes: 0

Views: 550

Answers (1)

Sajjad Sarwar
Sajjad Sarwar

Reputation: 106

PYMuPDF is the python library, which is dealing with such stuff. I see an article here which is talking about a similar thing. I personally used the PyMuPDF also known as fitz library which works well.

Upvotes: 1

Related Questions