Documentation
¶
Overview ¶
Package pdftext extracts plain text from PDFs that carry a real text layer (i.e. not a scan) without any external service. It exists so readPDFFile has a better no-docling fallback than raw base64 pass-through: most PDFs - reports, exports, invoices - are text-native, and pdfcpu (already a dependency here) only exposes page/content-stream manipulation, not decoded text.
Index ¶
Constants ¶
const MinCharsPerPage = 20
MinCharsPerPage is the threshold below which extracted text is treated as "not really there" - a scanned/image-only PDF will still yield a handful of stray characters from stamps or embedded metadata, but nowhere near this per page on average. Below it, callers should prefer OCR (docling) or the base64/vision fallback instead of trusting this near-empty text.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
Text string
PageCount int
// Sparse is true when the extracted text is too little relative to the
// page count to be a real text layer - most likely a scanned PDF.
Sparse bool
}
Result holds the outcome of a native PDF text extraction attempt.