Add support to extract text from PDFs that already contain a text layer (i.e. having been previously OCRed)#290
Conversation
dd28811 to
b997eb1
Compare
|
CI fails, since debian package libpoppler-cpp-dev needs to be installed |
|
This is also great work, thanks. As you've already noted, the new system-level dependency of Merging this branch will require updating the requirements section of the documentation as well as including a note about breaking changes in the release notes. Travis will have to be tinkered with a bit as well to add the dependency somehow. I've been meaning to make some changes to the .travis.yml file lately anyway, so this is as good an excuse as any :-) So TL;DR: I love this PR and will merge it, but one of us needs to make a few adaptations first. If you've got the time, feel free to try your hand at any of the above, but if not, I'll try to get to these this week. Thanks again! This is great. |
2c41d1b to
deb2926
Compare
…er (i.e. having been previously OCRed)
deb2926 to
4050846
Compare
|
Did the changes (including the release notes) - please have a look. I also checked again whether there is any pure-python library for reading text from PDFs. The only library I could find is PyPDF2 but the documentation says this (see http://pythonhosted.org/PyPDF2/PageObject.html#PyPDF2.pdf.PageObject.extractText):
This is unfortunately not what we need. |
…if_ocr_is_required
|
Ok! I had to take a little time to work out the kinks between this PR and the big Docker one we merged earlier today, but I think I've got it. With the conflicts, I had to do a manual merge, but all of your changes are in there, including credit for your work in the Changelog. Thanks again for this, and I'm sorry that the conflicts mucked things up. So many people are sending me stuff these past few days. |
|
Nice work on this one @BastianPoe! Just tried it out and it makes a huge difference for generated documents. |
This change will try to detect if a PDF document already contains text (i.e. has been previously OCRed) and then skips tesseract.
Override via PAPERLESS_OCR_ALWAYS=YES is possible.