Trap PDF/A-3 errors on old Ghostscript

This commit is contained in:
James R. Barlow 2018-05-04 15:29:43 -07:00
parent 5c8a007f3e
commit 9226f8a5d1
2 changed files with 8 additions and 0 deletions

View File

@ -398,6 +398,11 @@ def check_options_output(options, log):
if options.output_type == 'pdfa':
options.output_type = 'pdfa-2'
if options.output_type == 'pdfa-3' and ghostscript.version() < '9.19':
raise MissingDependencyError(
"--output-type pdfa-3 requires Ghostscript 9.19 or later"
)
lossless_reconstruction = False
if options.pdf_renderer in ('hocr', 'sandwich'):
if not any((options.deskew, options.clean_final, options.force_ocr,

View File

@ -953,6 +953,9 @@ def test_sidecar_nonempty(spoof_tesseract_cache, resources, outpdf):
@pytest.mark.parametrize('pdfa_level', ['1', '2', '3'])
def test_pdfa_n(spoof_tesseract_cache, pdfa_level, resources, outpdf):
if pdfa_level == '3' and ghostscript.version() < '9.19':
pytest.xfail(reason='Ghostscript >= 9.19 required')
check_ocrmypdf(
resources / 'ccitt.pdf', outpdf,
'--output-type', 'pdfa-' + pdfa_level,