Skip to content

Remove existing text layer before writing final file #62

@getglad

Description

@getglad

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions