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

Meta-Issue: PDF Cleanup #19

Open
billfitzgerald opened this issue Jan 26, 2022 · 0 comments
Open

Meta-Issue: PDF Cleanup #19

billfitzgerald opened this issue Jan 26, 2022 · 0 comments

Comments

@billfitzgerald
Copy link
Owner

Currently, PDF cleanup is working in both Linux and OSX.

The way it's working definitely needs improvement. This issue documents the current approach, some of the rationale behind this less-than-ideal approach, and some general thoughts on moving forward.

The thoughts in this ticket are reflected in the update pushed to the repo here: d3f26ad

Current approach and rationale

The original version was written and tested in Linux, and used OCRMyPDF. The results from OCRMyPDF are good.

However, using OCRMyPDF in OSX didn't work cleanly, even when using an "ifmain" guard as specified by the documentation here: https://ocrmypdf.readthedocs.io/en/latest/api.html

To address this issue, I switched over to PDFMiner.six, which worked in OSX, and did not throw exceptions. However, the results were not as clean, and part of what's nice about OCRMyPDF is that it will also OCR text from images.

The current "solution" (which isn't awesome) is to check for the OS of the machine running the script. OSX users are routed to use PDFMiner; Linux users are routed to use OCRMyPDF. Windows users should probably be routed to use PDFMiner as well, but I don't have a Windows machine to test against, so Windows is not currently supported.

Future path

In the future, I'd rather use a single method for cleaning PDFs.

Additionally, even using OCRMyPDF, the average PDF still has a lot of cruft that needs to be cleaned from the output, so future will will also include better text cleanup.

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

1 participant