Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invisible text layer #239

Open
lbr991 opened this issue Jul 3, 2023 · 1 comment
Open

invisible text layer #239

lbr991 opened this issue Jul 3, 2023 · 1 comment

Comments

@lbr991
Copy link

lbr991 commented Jul 3, 2023

I'm trying to take a non-searchable pdf and convert it to searchable pdf by superimposing an invisible text layer.
I need the invisible text bboxes to align exactly with the original bboxes (extracted by Textract).
I also don't want to specify a font and font_size because then the bboxes wouldn't align perfectly.

Is this possible with pdfrw?

@sl2c
Copy link

sl2c commented Sep 19, 2023

Everything is possible with pdfrw, but there's no out-of-the-box solution. However, it can be done in a straightforward way using pdfrwx, see e.g.: https://github.com/sl2c/pdfrwx/blob/master/hocreditor.py — this is an example class that inserts OCR layer specified using hOCR format as invisible text in PDF.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants