mirror of
https://github.com/ocrmypdf/OCRmyPDF.git
synced 2026-01-06 20:21:36 +00:00
32 lines
909 B
Python
32 lines
909 B
Python
#!/usr/bin/env python3
|
|
# © 2017 James R. Barlow: github.com/jbarlow83
|
|
|
|
from subprocess import Popen, PIPE, check_output, check_call, DEVNULL
|
|
import os
|
|
import shutil
|
|
from contextlib import suppress
|
|
import sys
|
|
import pytest
|
|
from ocrmypdf.pageinfo import pdf_get_all_pageinfo
|
|
import PyPDF2 as pypdf
|
|
from ocrmypdf.exceptions import ExitCode
|
|
from ocrmypdf import leptonica
|
|
from ocrmypdf.pdfa import file_claims_pdfa
|
|
from ocrmypdf.exec import tesseract
|
|
|
|
|
|
# Skip all tests in this file if not tesseract 4
|
|
pytestmark = pytest.mark.skipif(not tesseract.v4(),
|
|
reason="tesseract 4.0 required")
|
|
|
|
|
|
@pytest.mark.skipif(not tesseract.has_textonly_pdf(),
|
|
reason="requires textonly_pdf feature")
|
|
def test_textonly_pdf(resources, outdir):
|
|
pytest.helpers.check_ocrmypdf(
|
|
resources / 'linn.pdf',
|
|
outdir / 'linn_textonly.pdf', '--pdf-renderer', 'tess4')
|
|
|
|
|
|
|