diff --git a/docs/release_notes.rst b/docs/release_notes.rst index a0d3b635..f9ab4676 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -16,7 +16,7 @@ v6.1.4 - The test cache was updated to reflect the change above. -- Change test suite to accommodate Ghostscript 9.23's new ability to insert JPEGs into PDFs without transcoding. An apparent `regression in Ghostscript 9.23 `_ will cause some ocrmypdf output files to become invalid in rare cases; the workaround for the moment is to set ``--force-ocr``. +- Change test suite to accommodate Ghostscript 9.23's new ability to insert JPEGs into PDFs without transcoding. - XMP metadata in PDFs is now examined using ``defusedxml`` for safety. @@ -24,6 +24,11 @@ v6.1.4 - qpdf 7.0.0 or newer is now required as the test suite can no longer pass without it. +Notes +~~~~~ + +- An apparent `regression in Ghostscript 9.23 `_ will cause some ocrmypdf output files to become invalid in rare cases; the workaround for the moment is to set ``--force-ocr``. + v6.1.3 ------ diff --git a/src/ocrmypdf/exec/ghostscript.py b/src/ocrmypdf/exec/ghostscript.py index 531e6c69..7a123001 100644 --- a/src/ocrmypdf/exec/ghostscript.py +++ b/src/ocrmypdf/exec/ghostscript.py @@ -127,6 +127,10 @@ def generate_pdfa(pdf_pages, output_file, compression, log, "-dAutoFilterGrayImages=true", ] + # Older versions of Ghostscript expect a leading slash, newer ones should + # not have it. See Ghostscript git commit fe1c025d. + strategy = 'RGB' if ghostscript.version() >= '9.19' else '/RGB' + with NamedTemporaryFile(delete=True) as gs_pdf: args_gs = [ "gs", @@ -137,7 +141,7 @@ def generate_pdfa(pdf_pages, output_file, compression, log, "-dNumRenderingThreads=" + str(threads), "-sDEVICE=pdfwrite", "-dAutoRotatePages=/None", - "-sColorConversionStrategy=RGB", + "-sColorConversionStrategy=" + strategy, "-sProcessColorModel=DeviceRGB" ] + compression_args + [ "-dJPEGQ=95",