diff --git a/tests/resources/README.rst b/tests/resources/README.rst index 561c5fa7..7c74aa67 100644 --- a/tests/resources/README.rst +++ b/tests/resources/README.rst @@ -100,6 +100,9 @@ under the terms of the license in LICENSE.rst. * - trivial.pdf - @jbarlow83 - smallest possible valid PDF-1.3 with all required fields + * - vector.pdf + - @Catscratch + - a PDF with vector art and text rendered as curves with no fonts Assemblies diff --git a/tests/resources/vector.pdf b/tests/resources/vector.pdf new file mode 100644 index 00000000..a8ed7ff8 Binary files /dev/null and b/tests/resources/vector.pdf differ diff --git a/tests/test_main.py b/tests/test_main.py index e371dd74..63307726 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1081,4 +1081,20 @@ def test_decompression_bomb(resources, outpdf): outpdf, '--max-image-mpixels', '2000' ) - assert p.returncode == 0 \ No newline at end of file + assert p.returncode == 0 + + +def test_text_curves(spoof_tesseract_noop, resources, outpdf): + check_ocrmypdf( + resources / 'vector.pdf', outpdf, env=spoof_tesseract_noop) + + info = PdfInfo(outpdf) + assert len(info.pages[0].images) == 0, "added images to the vector PDF" + + check_ocrmypdf( + resources / 'vector.pdf', outpdf, '--force-ocr', + env=spoof_tesseract_noop) + + info = PdfInfo(outpdf) + assert len(info.pages[0].images) != 0, "force did not rasterize" +