Skip to content

Commit

Permalink
Fix test suite failure with Ghostscript >= 10.3
Browse files Browse the repository at this point in the history
Ghostscript is more picky about a specific case with SMask that cannot be converted to PDF/A

Details here
ArtifexSoftware/ghostpdl@4dcfae3
  • Loading branch information
James Barlow committed Mar 20, 2024
1 parent feeb9f2 commit 855de28
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/test_preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
from PIL import Image

from ocrmypdf._exec import ghostscript, tesseract
from ocrmypdf.exceptions import ExitCode
from ocrmypdf.helpers import Resolution
from ocrmypdf.pdfinfo import PdfInfo

from .conftest import check_ocrmypdf, have_unpaper
from .conftest import check_ocrmypdf, have_unpaper, run_ocrmypdf

RENDERERS = ['hocr', 'sandwich']

Expand Down Expand Up @@ -107,14 +108,18 @@ def test_non_square_resolution(renderer, resources, outpdf):
in_pageinfo = PdfInfo(resources / 'aspect.pdf')
assert in_pageinfo[0].dpi.x != in_pageinfo[0].dpi.y

check_ocrmypdf(
proc = run_ocrmypdf(
resources / 'aspect.pdf',
outpdf,
'--pdf-renderer',
renderer,
'--plugin',
'tests/plugins/tesseract_cache.py',
)
# PDF/A conversion can fail for this file if Ghostscript >= 10.3, so don't test
# exit code in that case
if proc.returncode != ExitCode.pdfa_conversion_failed:
proc.check_returncode()

out_pageinfo = PdfInfo(outpdf)

Expand Down

0 comments on commit 855de28

Please sign in to comment.