mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-12 09:21:17 +00:00
* M7: open local GoToR PDF links natively * GoToR links: read only regular .pdf files under a size cap; add missing translations A GoToR link in an untrusted PDF could name /dev/zero (unbounded read), a FIFO (UI thread hangs) or a directory. Both the UI path and the `link_open` tool now go through `pdfcraft_engine::read_remote_document`, which requires a `.pdf` extension and a regular file (metadata checked before opening) of at most 1 GiB, and stops reading if the file grows past the cap. Regression tests cover directories, a /dev/zero symlink and a FIFO (unix) in the engine, the tool and the UI. Adds the four link notifications to all 20 catalogs and "The existing action will be preserved." to el, es, pl, te and zh-hant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Brandon Thomas <echelon@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.6 KiB
Rust
40 lines
1.6 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 structure;
|
||
pub mod text;
|
||
|
||
pub use inspect::{
|
||
Annotation, Attachment, AttachmentSource, DestView, DocInfo, Field, FieldKind, FontInfo, Layer, LayerOp, Link, LinkTarget, OutlineItem, PageInfo,
|
||
RemoteDestination, Xfa, attachment_data, check_pages, inspect, pretty_date,
|
||
};
|
||
pub use pixels::Pixels;
|
||
pub use raster::{
|
||
MAX_PIXELS, MAX_SIDE, PageRenderer, RenderConfig, RenderPool, RenderRequest, RenderStats, RenderWarning, RenderedPage, RequestKind, Retiring,
|
||
Tile, device_pixels, effective_scale,
|
||
};
|
||
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),
|
||
}
|