ontocast.tool.pdf_regime¶
Whether a PDF carries a text layer, to choose a conversion profile per document.
Attributes¶
MIN_PAGE_CHARS = 40
module-attribute
¶
SAMPLE_PAGES = 8
module-attribute
¶
logger = logging.getLogger(__name__)
module-attribute
¶
Functions:¶
pdf_has_text_layer(data)
¶
True when at least half of the sampled pages carry extractable text.
Invisible text counts: a scan with an OCR text layer is read from that layer rather than re-recognised. A PDF that cannot be opened counts as having no text layer, so it goes to the OCR profile.