Raise exception if resulting PDF might appear blank in a known in some PDF viewers
Fixes #1187
This commit is contained in:
Binary file not shown.
@@ -13,7 +13,7 @@ import pytest
|
||||
from PIL import Image, UnidentifiedImageError
|
||||
|
||||
from ocrmypdf._exec.ghostscript import DuplicateFilter, rasterize_pdf
|
||||
from ocrmypdf.exceptions import ExitCode
|
||||
from ocrmypdf.exceptions import ColorConversionNeededError, ExitCode
|
||||
from ocrmypdf.helpers import Resolution
|
||||
|
||||
from .conftest import check_ocrmypdf, run_ocrmypdf_api
|
||||
@@ -126,6 +126,16 @@ def test_ghostscript_feature_elision(resources, outpdf):
|
||||
)
|
||||
|
||||
|
||||
def test_ghostscript_mandatory_color_conversion(resources, outpdf):
|
||||
with pytest.raises(ColorConversionNeededError):
|
||||
check_ocrmypdf(
|
||||
resources / 'jbig2_baddevicen.pdf',
|
||||
outpdf,
|
||||
'--plugin',
|
||||
'tests/plugins/tesseract_noop.py',
|
||||
)
|
||||
|
||||
|
||||
def test_rasterize_pdf_errors(resources, no_outpdf, caplog):
|
||||
with patch('ocrmypdf._exec.ghostscript.run') as mock:
|
||||
# ghostscript can produce
|
||||
|
||||
Reference in New Issue
Block a user