A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
implement PAPERLESS_OCR_MAX_IMAGE_PIXELS
Henning Häckera8887b211ee6
diff --git a/docs/configuration.rst b/docs/configuration.rstindex 82a14ae52..ab35b49d4 100644--- a/docs/configuration.rst+++ b/docs/configuration.rst@@ -389,6 +389,15 @@ PAPERLESS_OCR_IMAGE_DPI=<num>Default is none, which will automatically calculate image DPI so thatthe produced PDF documents are A4 sized.+PAPERLESS_OCR_MAX_IMAGE_PIXELS=<num>+ Paperless will not OCR images that have more pixels than this limit.+ This is intended to prevent decompression bombs from overloading paperless.+ Increasing this limit is desired if you face a DecompressionBombError despite+ the concerning file not being malicious; this could e.g. be caused by invalidly+ recognized metadata.+ If you have enough resources or if you are certain that your uploaded files+ are not malicious you can increase this value to your needs.+ The default value is 256000000.PAPERLESS_OCR_USER_ARGS=<json>OCRmyPDF offers many more options. Use this parameter to specify anydiff --git a/src/paperless_tesseract/parsers.py b/src/paperless_tesseract/parsers.pyindex ad167ecf0..4065890ec 100644--- a/src/paperless_tesseract/parsers.py+++ b/src/paperless_tesseract/parsers.py@@ -8,6 +8,7 @@ from documents.parsers import make_thumbnail_from_pdffrom documents.parsers import ParseErrorfrom PIL import Image+Image.MAX_IMAGE_PIXELS = os.environ.get('PAPERLESS_OCR_MAX_IMAGE_PIXELS', Image.MAX_IMAGE_PIXELS)class NoTextFoundException(Exception):passdiff --git a/src/paperless_text/parsers.py b/src/paperless_text/parsers.pyindex a0f19c020..e41e25e76 100644--- a/src/paperless_text/parsers.py+++ b/src/paperless_text/parsers.py@@ -6,6 +6,7 @@ from PIL import Imagefrom PIL import ImageDrawfrom PIL import ImageFont+Image.MAX_IMAGE_PIXELS = os.environ.get('PAPERLESS_OCR_MAX_IMAGE_PIXELS', Image.MAX_IMAGE_PIXELS)class TextDocumentParser(DocumentParser):"""