mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-30 21:17:55 -06:00
XFA forms aren't read yet, and opening one gave no hint: a dynamic XFA form showed only its "Please wait…" placeholder page, and a static one looked like an ordinary form though Acrobat shows its XFA data in preference to the fields that get filled. - render: DocInfo.xfa (Static / Dynamic) from /AcroForm /XFA; dynamic when /NeedsRendering is true or there are no fields. Exported for doc_info (automation and CLI) as "xfa". - ui: the notice bar explains each case (above the form-fields notice); a static form keeps its Highlight fields button. - Tests: tests/xfa.rs (dynamic with and without /NeedsRendering, static, ordinary forms, a malformed /XFA). Parity notes for form.xfa-static and form.xfa-dynamic (still planned: this explains XFA, it doesn't support it). Reported by @Sudachi-dev. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34 lines
1.4 KiB
Rust
34 lines
1.4 KiB
Rust
//! printcraft-render — page rasterization and document inspection.
|
||
//!
|
||
//! **Bootstrap status (see ADR-0004):** rasterization goes straight through the `hayro` crate
|
||
//! (hayro-interpret + vello_cpu), and inspection (outline, annotations, fields, layers,
|
||
//! attachments, metadata) uses `lopdf`. Both are replaced by our own `cos`/`model` crates and the
|
||
//! DisplayList device design in M1–M2. The public API here 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 raster;
|
||
pub mod text;
|
||
|
||
pub use inspect::{
|
||
Annotation, Attachment, AttachmentSource, DocInfo, Field, FieldKind, FontInfo, Layer, Link, LinkTarget, OutlineItem, PageInfo, Xfa,
|
||
attachment_data, inspect, pretty_date,
|
||
};
|
||
pub use raster::{MAX_PIXELS, MAX_SIDE, PageRenderer, RenderConfig, RenderPool, RenderRequest, RenderedPage, RequestKind, Tile, 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),
|
||
}
|