Set Ghostscript -sColorConversionStrategy the way old/new versions expect

This commit is contained in:
James R. Barlow
2018-04-12 16:28:48 -07:00
parent 10aa59f674
commit 9b731d63b8
2 changed files with 11 additions and 2 deletions
+6 -1
View File
@@ -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 <https://bugs.ghostscript.com/show_bug.cgi?id=699216>`_ 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 <https://bugs.ghostscript.com/show_bug.cgi?id=699216>`_ 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
------
+5 -1
View File
@@ -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",