diff --git a/src/ocrmypdf/__main__.py b/src/ocrmypdf/__main__.py index 16900ba3..aa4490c4 100755 --- a/src/ocrmypdf/__main__.py +++ b/src/ocrmypdf/__main__.py @@ -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, diff --git a/tests/test_main.py b/tests/test_main.py index e08d31b1..c65f3cdd 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -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,