Expand description
PDF extractor — born-digital text, reconstructed from glyph positions.
A PDF has no paragraphs, no headings and no reading order: it has glyphs at coordinates. Everything structural here is a reconstruction, so the shape of this module is a pipeline of increasingly opinionated steps:
Collectorreceives every character with its position and size frompdf-extract, which has already done the hard part — resolving font encodings and CMaps into real text.- characters group into lines by their baseline;
- lines group into columns by their horizontal spans;
- lines group into paragraphs by vertical gaps and ragged right edges;
- a line noticeably larger than the page’s body text becomes a heading.
Tables are deliberately not reconstructed: a wrong table is worse to read than the paragraphs it was made from, and the PRD puts complex tabular PDF outside v0.1’s lane. Scanned pages yield no characters at all, which the caller turns into the “looks like a scan” exit code.
Structs§
- Line
- A run of characters sharing a baseline.
- Parsed
- What a parsed PDF yields.
- PdfExtractor
Functions§
- column_
bounds - Find column boundaries in a set of horizontal spans.
- parse
- Parse PDF bytes, optionally limited to a page range.