Expand description
Text out of documents, and PDF pages as pictures, in pure Rust.
- PDF (
pdf): text per page (hayro’s interpreter, a text-collecting device), page count, and a page rendered to PNG (hayro’s rasteriser) for a vision model. - Word and PowerPoint (
ooxml):.docxand.pptxare zip files of XML; their text comes out as rough Markdown (headings, lists, tables), slides one by one.
Every input is hostile: sizes are capped (zip entries are read with a limit, so a zip bomb stops early), parser panics are caught, and errors are short sentences a model can act on.
Modules§
- ooxml
- Word (
.docx) and PowerPoint (.pptx) text as rough Markdown. - PDF: text per page and pages as PNG, on hayro.
Enums§
- Kind
- What a file is, by its name and first bytes.
Constants§
- MAX_
FILE_ BYTES - Largest document file read (bytes).
Functions§
- page_
ranges - Pages as compact ranges:
[1,2,3,5]→"1-3,5". - parse_
pages - Parse a page list like
"3","1-3,5","4-"or"all"againsttotalpages. Pages count from 1; the result is sorted, without duplicates, at mostmaxlong.