Skip to main content

rightkit_pdf/
lib.rs

1//! RightKit PDF engine: the pure, Tauri-free half of the PDF edit pipeline, extracted from
2//! ViewRight's `crates/pdf` (the most mature donor), plus ScrapeRight text extraction and Legion
3//! page merge as opt-in features.
4//!
5//! Every function takes bytes, paths, or in-memory `lopdf::Document`s and returns typed values.
6//! Path authorization (the host's file broker) stays in the app; [`commit`] provides the atomic
7//! disk write (through `rightkit-fs`) once the host has authorized a target.
8//!
9//! | module    | responsibility                                                    |
10//! |-----------|-------------------------------------------------------------------|
11//! | `model`   | wire types: commands, islands, locators, typed `PdfEditError`     |
12//! | `inspect` | page graph walk: text islands with quads, fonts, source locators  |
13//! | `font`    | bundled + system font catalog, subsetting, ToUnicode              |
14//! | `compose` | sparse-write composition of edit commands onto fresh bytes        |
15//! | `save`    | candidate verification, single-use save tokens, commit resolution |
16//! | `commit`  | (feature `edit`) lock, recheck and rightkit-fs replace of a token |
17//! | `merge`   | (feature `merge`) merge PDFs, select/reorder pages                |
18//! | `organize`| (feature `merge`) delete, reorder, rotate, insert pages; keeps outline and labels |
19//! | `extract` | (feature `extract`) text extraction, whole-document and per page  |
20//! | `scan`    | scanned-page detection (no text layer, page-sized image)          |
21//! | `raster`  | (feature `raster`) render scanned pages to gray/RGBA/PNG for OCR  |
22//! | `redact`  | (feature `redact`) remove content under marks, fail closed        |
23//! | `forms`   | (feature `forms`) AcroForm fields, set values, appearances        |
24//! | `optimize`| (feature `optimize`) unused objects, measured image downsampling  |
25//! | `write`   | build a new PDF: JPEG pages, ICC profiles, page sizes (`write_to` needs `edit`) |
26
27#[cfg(feature = "edit")]
28pub mod commit;
29#[cfg(feature = "edit")]
30pub mod compose;
31#[cfg(feature = "extract")]
32pub mod extract;
33#[cfg(feature = "fonts")]
34pub mod font;
35#[cfg(feature = "forms")]
36pub mod forms;
37pub mod inspect;
38#[cfg(feature = "merge")]
39pub mod merge;
40pub mod model;
41#[cfg(feature = "optimize")]
42pub mod optimize;
43#[cfg(feature = "merge")]
44pub mod organize;
45#[cfg(feature = "raster")]
46pub mod raster;
47#[cfg(feature = "redact")]
48pub mod redact;
49#[cfg(feature = "edit")]
50pub mod save;
51pub mod scan;
52#[cfg(test)]
53mod test_fixtures;
54pub mod write;