We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Create searchable PDFs from images and text

Hello,

I need to be able to create PDF files from images and text files that show the images and have the text embedded (hidden) underneath the image.

The text files come from one of 2 sources, a print driver (BlackIce) or an OCR program. In both cases the text file contains the coordinates (in pixels) and fonts of the text which match up with the image. I've attached a sample of the input. I'm already able to parse out the fonts/positions and text from the txt file to put in the PDF file.

The question is whether it's possible with Aspose.PDF to add "hidden" text behind an image in order to make it searchable (in Adobe reader, if you searched for the word, it would highlight the matching part of it from the image).

Here is a sample from the text file

[[225,335,348,386][10][B,,][Tahoma]]From:

the bracketed portion indicates that the text ("From:") is in font is Tahoma, 10 point bold and that the bounding rectangle has a top left x,y of (225,335) and bottom right coordinate of (348,386).

I would need to be able to insert text at those coordinates (I can convert them to another scale, i.e. inches if necessary) on that page of the PDF containing the image.

Looking at the documentation I found a way to add text from coordinates using PdfFileMend, but in testing it the issues were that it does not support many fonts and that it puts the text over the image (I tried setting foreground/background to transparent but it ended up covering the image part of it with a white rectangle).

Thanks

Doug

Hi Dough,

Thanks for using our products.

DougO1081:

The question is whether it's possible with Aspose.PDF to add "hidden" text behind an image in order to make it searchable (in Adobe reader, if you searched for the word, it would highlight the matching part of it from the image).

You may check the following documentation link for details and code snippet as per your requirement.

How to - Create MultiLayer PDF document

If you still face any issue, we would appreciate, if you create a sample application and post here to show us the issue. This will help us to regenerate the issue and get the cause of the issue soon.

We apologize for your inconvenience.

Thanks & Regards,