I am looking for a library that helps me to add invisible text to PDF and make the text searchable. In my project, i can get the text via OCR technology. If you have any suggestion, please guide me to do so.
This article on XsPDF.com is what you looking for, check out: How to insert text into a PDF
Answers
From my point of view, i have the suggestions as follows.
- You can render text to be invisible on PDF page.
- You can draw text under something, thus make it invisible to be readers.
- You can add text first, and then add an image to it. The text will be "hidden" to the end user, but will still be searchable by the search engine. This may also be useful.
Yeah, i have ever tried the third way. Firstly create a PDF document containing text and add an image on top of it. This is really useful for your case.
It is not necessary to render the text to be invisible on PDF. You can just render it to a certain position and make the scanned image on the text. Another way is to render text over image and set alpha value of the color of the the stroke and brush to zero.
If you have already scanned the image using OCR text, most PDF libraries on the market like XsPDF can help you to render the scanned image on PDF page and then render a separate text output on it. You should render text on page instead of on image, just over text elements on image elements in PDF page.