From 8102ca1075f36a24467688d4ab9136cd4556cd4b Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Fri, 14 Sep 2018 15:53:26 -0700 Subject: [PATCH] Backport blacklist of Ghostscript 9.24 --- src/ocrmypdf/__main__.py | 8 ++++++++ src/ocrmypdf/exec/ghostscript.py | 3 ++- src/ocrmypdf/pipeline.py | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/ocrmypdf/__main__.py b/src/ocrmypdf/__main__.py index 1f2bda70..dc89d303 100755 --- a/src/ocrmypdf/__main__.py +++ b/src/ocrmypdf/__main__.py @@ -863,6 +863,14 @@ def run_pipeline(): "security vulnerabilities with certain malformed PDFs. Consider " "upgrading to version 7.0.0 or newer.".format(qpdf.version())) + if ghostscript.version() == '9.24': + complain( + "Ghostscript 9.24 contains serious regressions and is not " + "supported. Please upgrade to Ghostscript 9.25 or use an older " + "version." + ) + return ExitCode.missing_dependency + # Any changes to options will not take effect for options that are already # bound to function parameters in the pipeline. (For example # options.input_file, options.pdf_renderer are already bound.) diff --git a/src/ocrmypdf/exec/ghostscript.py b/src/ocrmypdf/exec/ghostscript.py index aa1e7712..a18169b7 100644 --- a/src/ocrmypdf/exec/ghostscript.py +++ b/src/ocrmypdf/exec/ghostscript.py @@ -43,7 +43,8 @@ def jpeg_passthrough_available(): https://bugs.ghostscript.com/show_bug.cgi?id=699216 The issue was fixed for 9.24, hence that is the first version we consider - the feature available. + the feature available. (However, we don't use 9.24 at all, so the first + version that allows JPEG passthrough is 9.25. Regardless, in ocrmypdf 6.x we are ignoring this new feature entirely to avoid new behavior. diff --git a/src/ocrmypdf/pipeline.py b/src/ocrmypdf/pipeline.py index acd5d395..8fcdc7d0 100644 --- a/src/ocrmypdf/pipeline.py +++ b/src/ocrmypdf/pipeline.py @@ -935,8 +935,8 @@ def generate_postscript_stub( v.encode('ascii', errors='strict') except UnicodeEncodeError: log.warning( - "Ghostscript 9.24 does not support Unicode strings in metadata." - " These will be converted to ASCII if possible." + "Ghostscript 9.24+ does not support Unicode strings in " + " metadata. These will be converted to ASCII if possible." ) generate_pdfa_ps(output_file, pdfmark, ascii_docinfo=ascii_docinfo)