Create test case for Form XObjects

This commit is contained in:
James R. Barlow 2017-02-14 12:51:15 -08:00
parent 5a817370fd
commit d1a0065ef8
5 changed files with 16 additions and 3 deletions

View File

@ -356,9 +356,6 @@ def check_options(options, log):
sys.exit(ExitCode.missing_dependency)
# ----------
# Logging

View File

@ -64,6 +64,9 @@ under the terms of the license in LICENSE.rst.
* - epson.pdf
- @lowesjam
- a linearized PDF containing some unusual indirect objects, created by an Epson printer; printout of a Wikipedia article (CC BY-SA)
* - formxobject.pdf
- @jbarlow83
- hand-crafted exotic PDF containing an image inside a Form XObject
* - francais.pdf
- @jbarlow83
- a page containing French accents (diacritics)

Binary file not shown.

View File

@ -742,3 +742,9 @@ THIS FILE IS INVALID
'--tesseract-config', str(cfg_file))
assert "parameter not found" in err, "No error message"
assert p.returncode == ExitCode.invalid_config
def test_form_xobject(spoof_tesseract_noop, resources, outpdf):
check_ocrmypdf(resources / 'formxobject.pdf', outpdf,
'--force-ocr',
env=spoof_tesseract_noop)

View File

@ -101,3 +101,10 @@ def test_jpeg(resources, outdir):
assert pdfimage['enc'] == 'jpeg'
assert (pdfimage['dpi_w'] - 150) < 1e-5
def test_form_xobject(resources):
filename = resources / 'formxobject.pdf'
pdfinfo = pageinfo.pdf_get_all_pageinfo(str(filename))
pdfimage = pdfinfo[0]['images'][0]
assert pdfimage['width'] == 50