Skip to main content

Crate byob_docs

Crate byob_docs 

Source
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): .docx and .pptx are 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
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" against total pages. Pages count from 1; the result is sorted, without duplicates, at most max long.