aeat.adapters.inbound.justificante._parsers._pdfplumber_backend module

pdfplumber-backed text extraction for justificante PDFs.

Implements the PDFPLUMBER branch of JustificanteParserBackend for the adapters.inbound.justificante._parsers dispatch layer. Concatenates the page.extract_text() output of every non-empty page; layout-sensitive parsing is left to the regex extractor downstream.

Both path and bytes helpers translate extraction failures into JustificanteParseError. The bytes helper uses the shared inbound PDF bytes primitive so secure-storage captures can be parsed without plaintext temporary files.

extract_text_pdfplumber(pdf_path)[source]

Return the concatenated text of pdf_path using pdfplumber.

Parameters:

pdf_path (Path) – Path to the PDF to open.

Return type:

str

Returns:

A single string with every page’s extract_text result joined by newlines. Empty pages are skipped.

Raises:

JustificanteParseError – If pdfplumber cannot read any text.

extract_text_pdfplumber_bytes(pdf_bytes)[source]

Return concatenated text from in-memory PDF bytes using pdfplumber.

Raises:

JustificanteParseError – If pdfplumber cannot read any text.

Return type:

str

Parameters:

pdf_bytes (bytes)