mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-15 17:07:19 +00:00
A single squashed port of the branch's four commits onto current main, which split annot's lib.rs (info.rs, modify.rs), render's inspect.rs (model.rs, annotations.rs, tests.rs), engine's lib.rs (comments.rs, edit/run.rs) and ui-egui's comments.rs (tools/comments/*). The behaviour and tests are the branch's (ISO 32000-2 §12.5.6.2): - a group subordinate is part of its primary's comment: listed, selected, exported and deleted with it, with the primary's attributes; - Replace Text writes the caret as the primary and the strikeout as its subordinate; earlier groups (strikeout primary, text on the caret) still list their text, through a map; - deleting a group refuses a locked member, and a subordinate whose primary is past the depth limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
47 lines
1.8 KiB
Rust
47 lines
1.8 KiB
Rust
//! pdfcraft-render — page rasterization and document inspection.
|
||
//!
|
||
//! **Bootstrap status (see ADR-0004):** rasterization goes straight through the `hayro` crate
|
||
//! (hayro-interpret + vello_cpu). Inspection uses the lazy `cos` reader with a read-only lopdf
|
||
//! object adapter and retains `lopdf` loading for compatibility repairs. The renderer and that
|
||
//! adapter are replaced by `model` and the DisplayList design in M1–M2. The public API is what the engine and UI rely on, so
|
||
//! the swap stays internal to this crate.
|
||
|
||
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
||
|
||
mod inspect;
|
||
mod pixels;
|
||
mod raster;
|
||
mod reading;
|
||
mod structure;
|
||
pub mod text;
|
||
pub mod transition;
|
||
|
||
pub use inspect::{
|
||
Annotation, Attachment, AttachmentSource, DestView, DocInfo, Field, FieldKind, FontInfo, Layer, LayerOp, Link, LinkTarget, MAX_GROUP_DEPTH,
|
||
OutlineItem, PageInfo, PageTransition, RemoteDestination, TransitionStyle, Xfa, attachment_data, check_pages, fill_group_text, group_primaries,
|
||
inspect, link_replies, pretty_date, thread_tops,
|
||
};
|
||
pub use pixels::Pixels;
|
||
pub use raster::{
|
||
MAX_PIXELS, MAX_SIDE, PRINT_TAG, PageRenderer, RenderConfig, RenderPool, RenderRequest, RenderStats, RenderWarning, RenderedPage, RequestKind,
|
||
Retiring, Tile, device_pixels, effective_scale,
|
||
};
|
||
pub use reading::{ReadingColors, ReadingParams};
|
||
pub use text::{PageText, TextGlyph};
|
||
|
||
/// Errors surfaced to the user when a document cannot be opened.
|
||
#[derive(Debug, thiserror::Error)]
|
||
pub enum OpenError {
|
||
#[error("the file is not a readable PDF: {0}")]
|
||
Invalid(String),
|
||
#[error("the document is protected by a password")]
|
||
NeedsPassword,
|
||
#[error("the password is incorrect")]
|
||
WrongPassword,
|
||
#[error("{0}")]
|
||
Unsupported(String),
|
||
}
|
||
|
||
#[cfg(test)]
|
||
mod lab_bradford_tests;
|