Skip to main content

Crate pdfboss_output

Crate pdfboss_output 

Source
Expand description

Layout analysis and output rendering for pdfboss: turns pdfboss-text spans into a structured layout IR, and the IR into a document.

Structs§

BBox
A device-space box: y grows upward, as in PDF user space.
Cell
One table cell. An empty cell — or one covered by a neighbour’s span — carries no line.
ExtractReport
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.
FontCache
Loaded fonts shared across page extractions of one document, keyed by the font dictionary’s object reference.
Inline
A run of same-styled text within a line. text already carries the spaces the word-gap rule inserted, so rendering a line is concatenation.
Line
One visual line. The geometry travels with it because later structure passes — lists, tables, page headers and footers — classify lines by it.
ListItem
One list item: its marker, the marker text’s length in characters (the continuation indent a wrapped item is measured against), and its lines.
Markdown
Markdown: ATX headings ranked by font size, one output line per source line, and emphasis around each run of styled text. Blocks — across pages too — are separated by a blank line.
PageLayout
One page’s blocks in reading order.
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.
SkippedText
One piece of content whose text (if any) is missing from the result.
Text
Plain text: every line of every block in reading order joined with \n, pages separated by a form feed. Structure is invisible here — this is the adapter that must stay byte-equal to positional text extraction.
TextSpan
A positioned run of extracted text.

Enums§

Block
One structural unit of a page, in reading order.
Marker
What introduces a list item.
Role
What a paragraph is to the page: its body, or a page header or footer repeated on every page.
SkipCause
Why the stream was skipped.
SkippedTextKind
Which kind of operator stream was skipped.

Traits§

Output
Renders laid-out pages into one document.

Functions§

document_layout
Every page’s spans as structure, ranking heading sizes against the whole document, so one oversized page cannot redefine what body text is.
document_layout_with_rulings
document_layout with each page’s rulings, so drawn grids become tables document-wide. With no rulings the two are the same function.
extract_markdown
Extracts the whole document as Markdown: ATX headings, paragraphs, and emphasis over the same positional layout extract_text renders flat.
extract_markdown_reporting
extract_markdown with one ExtractReport per page, in page order.
extract_page_markdown
One page as Markdown, ranking heading sizes against that page alone. extract_markdown is the better answer whenever the document is at hand — a page whose text is all one size has no heading to find.
extract_page_markdown_with
extract_page_markdown against any object source. Signed like extract_text_with, for the same reasons — oc gating included.
extract_text
Extracts the page’s text with positional layout applied: spans grouped into lines, lines ordered top to bottom and joined with \n, spaces inserted at horizontal gaps.
extract_text_reporting
extract_text with the report of what could not be read: an ExtractReport whose 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 text with an empty report really is an empty page.
extract_text_reporting_cached
extract_text_reporting with fonts cached across pages: a caller walking a whole document — pdfboss_core::map_pages included — passes one FontCache to every page and each font loads once for the document. The text is identical to the uncached call’s, page for page.
extract_text_reporting_with
extract_text_reporting against any object source. Signed like extract_text_with, for the same reasons — oc gating included.
extract_text_with
extract_text against any object source, awaiting whatever I/O the source needs to read the page — the same span extraction and layout. oc is the document’s optional-content visibility (the async document’s oc_state()); None extracts every layer.
layout
Groups spans into lines (baselines within 0.5 · size), orders lines top to bottom and spans left to right, inserts a space at horizontal gaps wider than WORD_GAP times the size, and joins lines with \n. A page with a clear two-column gutter reads column-major: full-width separators split it into bands, and within each band the left column flows before the right.
page_layout
The page’s spans as structure, ranking heading sizes against this page alone. Prefer document_layout whenever the whole document is at hand: a page of nothing but large type has no body size of its own.
page_layout_with_rulings
page_layout with the page’s rulings: a lattice of drawn borders is read as a table ahead of lane occupancy. With no rulings the two are the same function.