Open rog1039 opened 2 years ago
You could try drawing the string at the edge of the page, then the text might still be able to be searched. To my knowledge some readers have problem displaying transparent text.
Thanks for the input. That would work for that use case. In my case, I am trying to provide the option to highlight 'text' on the page itself. So if the image has 'some random text here' on the page, the user could use the text tool to highlight some or all of that text and copy it to the clipboard. For my use case this invisible/transparent text would have to be directly overtop the image of that text on the page. As far as I know, this is how most of the OCR programs that output searchable PDF documents work -- by applying an invisible/transparent layer of text overtop the original image.
Hello,
I was looking at making an existing PDF searchable. I have OCR results and was hoping to use DrawString to draw the text in an invisible way so the user can select and copy the text from the page but so it is otherwise not visible.
I tried using
new XSolidBrush(XColors.Transparent)
to make the text transparent but that just makes the text appear white over the image I am drawing on top of.Also I tried using DrawRectangle with a Transparent Pen and Transparent brush and that just drew a white rectangle on the page.
Not quite sure where I am going wrong.
This is the code I wrote:
Thanks!