I am sometimes in situations where the PDF's existing text layer is not great (character issues, etc), and the version this package creates is more reliable. Is it possible to remove the existing text layer and replace it with the one your package creates?
I think I have dug into where it is happening, but I don't know if original_page has a method for that or not.
I don't have a Linux dev environment (just running this from a Docker container) so I haven't been able to actually debug this yet.
|
ocr_pdf_filename = self.pdf.overlay_hocr_pages(img_dpi, hocr_filenames, pdf_filename) |
|
orig_pg = self._get_merged_single_page(orig_pg, text_pg) |
|
original_page.mergePage(ocr_text_page) |
It looks like from this SO post that you can extract the text, but I don't know about destroying it.
http://stackoverflow.com/questions/35090948/pypdf2-wont-extract-all-text-from-pdf/36914534#36914534
I am sometimes in situations where the PDF's existing text layer is not great (character issues, etc), and the version this package creates is more reliable. Is it possible to remove the existing text layer and replace it with the one your package creates?
I think I have dug into where it is happening, but I don't know if
original_pagehas a method for that or not.I don't have a Linux dev environment (just running this from a Docker container) so I haven't been able to actually debug this yet.
pypdfocr/pypdfocr/pypdfocr.py
Line 363 in c88a305
pypdfocr/pypdfocr/pypdfocr_pdf.py
Line 256 in c88a305
pypdfocr/pypdfocr/pypdfocr_pdf.py
Line 166 in c88a305
pypdfocr/pypdfocr/pypdfocr_pdf.py
Line 199 in c88a305
It looks like from this SO post that you can extract the text, but I don't know about destroying it.
http://stackoverflow.com/questions/35090948/pypdf2-wont-extract-all-text-from-pdf/36914534#36914534