aeat.application.ledger._evidence_textlayer module

On-host text-layer extraction from in-memory evidence bytes.

Runs the in-tree pdfplumber text extractor over a resolved EvidenceInput’s in-memory bytes, fully on-host. Nothing is written to disk and nothing leaves the machine (sensitive-financial-data-secure-storage-only). This is the cheapest on-host reader and covers text-native PDFs; image evidence and scan-only PDFs have no usable text layer and must go through the on-host vision reader instead.

extract_evidence_text(evidence)[source]

Return the on-host text layer of a PDF EvidenceInput as one string.

Parameters:

evidence (EvidenceInput) – Resolved in-memory evidence bytes.

Return type:

str

Returns:

The concatenated per-page text of the PDF (empty pages dropped).

Raises:

PurchaseInvoiceEvidenceInputError – When the evidence is not a PDF, or the PDF has no usable text layer (scan-only / XFA) – the caller falls back to the on-host vision reader in that case.