Expand description
Text extraction for pdfboss: font loading, encodings, ToUnicode CMaps, and positional text spans.
Structs§
- Extract
Report - What extraction could not read. Extraction is lenient the way rendering is — content that will not fetch, decode, or parse yields no text rather than an error — and this report is what keeps that leniency accountable: an empty result with an empty report really is an empty page.
- Font
Cache - Loaded fonts shared across page extractions of one document, keyed by the font dictionary’s object reference.
- Point
- A point in user or device space.
- Rect
- An axis-aligned rectangle described by two opposite corners
(x0, y0)and(x1, y1). - Ruling
- An axis-aligned line segment a page draws, in the same y-up user space as
TextSpan: a table border, a separator, an underline. - Skipped
Text - One piece of content whose text (if any) is missing from the result.
- Text
Span - A positioned run of extracted text.
Enums§
- Skip
Cause - Why the stream was skipped.
- Skipped
Text Kind - Which kind of operator stream was skipped.
Functions§
- extract_
spans - Extracts the page’s raw text spans (position, size and font per span).
- extract_
spans_ and_ rulings_ reporting extract_spans_reportingplus the page’s rulings: every axis-aligned segment the content strokes, and the centerline of every thin filled rectangle, in the same y-up user space as the spans. SeeRulingfor the normalization the returned segments carry.- extract_
spans_ and_ rulings_ reporting_ cached extract_spans_and_rulings_reportingwith fonts cached across calls — the rulings twin ofextract_spans_reporting_cached, for a caller walking a whole document page by page. Spans, rulings, and report are identical to the uncached call’s, for the same reason: the cache is keyed by each font dictionary’s object reference, never by its resource name, and rulings never touch fonts at all.- extract_
spans_ and_ rulings_ reporting_ cached_ with extract_spans_and_rulings_reporting_cachedagainst any object source. Signed likeextract_spans_with, for the same reasons —ocgating included.- extract_
spans_ and_ rulings_ reporting_ with extract_spans_and_rulings_reportingagainst any object source. Signed likeextract_spans_with, for the same reasons —ocgating included.- extract_
spans_ reporting extract_spanswith the report of what could not be read: anExtractReportwhose entries name each skipped stream and why — unsupported filters (the passthrough image codecs included), undecodable bytes, unparseable content, missing resources, exhausted form limits. An empty span list with an empty report really is an empty page.- extract_
spans_ reporting_ cached extract_spans_reportingwith fonts cached across calls: a caller walking a whole document passes oneFontCacheto every page, and each font dictionary — descriptor, widths, encoding, ToUnicode and font-program parsing included — loads once for the document instead of once per page. The cache isSend + Sync, so a parallel page walk may share it.- extract_
spans_ reporting_ cached_ with extract_spans_reporting_cachedagainst any object source. Signed likeextract_spans_with, for the same reasons —ocgating included.- extract_
spans_ reporting_ with extract_spans_reportingagainst any object source. Signed likeextract_spans_with, for the same reasons —ocgating included.- extract_
spans_ with extract_spansagainst any object source, awaiting whatever I/O the source needs to read the page.