Skip to main content

Crate pdf_xfa

Crate pdf_xfa 

Source
Expand description

XFA engine — extraction, layout rendering, font resolution.

This crate’s public API is panic-free. Errors are returned as Result<T, XfaError>.

§JavaScript policy

XFA forms that require JavaScript execution produce static-layout output by default. Full JavaScript execution requires the xfa-js-sandboxed feature flag.

§Module boundary notes

The *_bridge modules (appearance_bridge, font_bridge, image_bridge, paint_bridge, render_bridge) are pub because integration tests and the xfa-cli debug command access their items directly by module path. These modules are considered internal (not part of the stable API surface) and may change without a semver bump. External callers should prefer the stable re-exports at the crate root. Items not listed in the pub use block below are not covered by stability guarantees.

javascript_policy is similarly pub for cross-module visibility within the workspace. It is not intended as a public API for downstream crates.

Re-exports§

pub use classify::detect_xfa_type;
pub use classify::detect_xfa_type_from_packets;
pub use classify::XfaType;
pub use dynamic::DynamicScriptOutcome;
pub use dynamic::FormDomMatchEntry;
pub use dynamic::InstanceWriteEntry;
pub use dynamic::JsExecutionMode;
pub use dynamic::OutputQuality;
pub use dynamic::PresenceMutationEntry;
pub use dynamic::ScriptLifecycleEntry;
pub use dynamic::SkippedActivities;
pub use dynamic::SomFailEntry;
pub use extract::extract_embedded_fonts;
pub use extract::validate_xfa_packets;
pub use extract::PacketValidation;
pub use flatten::compare_flatten_quality;
pub use flatten::flatten_xfa_to_pdf;
pub use flatten::flatten_xfa_to_pdf_with_layout_dump;
pub use flatten::flatten_xfa_to_pdf_with_layout_dump_and_metadata;
pub use flatten::flatten_xfa_to_pdf_with_metadata;
pub use flatten::flatten_xfa_to_pdf_with_policy;
pub use flatten::flatten_xfa_to_pdf_with_policy_and_metadata;
pub use flatten::is_pdf_encrypted;
pub use flatten::validate_flattened_pdf;
pub use flatten::validate_text_completeness;
pub use flatten::FlattenMetadata;
pub use flatten::FlattenQualityMetrics;
pub use flatten::FlattenValidation;
pub use flatten::LayoutDump;
pub use flatten::LayoutDumpEntry;
pub use flatten::TextValidation;
pub use flatten::XfaRenderingPolicy;
pub use js_runtime::activity_allowed_for_sandbox;
pub use js_runtime::activity_allowed_for_sandbox_with_gate;
pub use js_runtime::presave_during_flatten_enabled;
pub use js_runtime::HostBindings;
pub use js_runtime::MutationLogEntry;
pub use js_runtime::NullRuntime;
pub use js_runtime::RuntimeMetadata;
pub use js_runtime::RuntimeOutcome;
pub use js_runtime::SandboxError;
pub use js_runtime::XfaJsRuntime;
pub use js_runtime::DEFAULT_MEMORY_BUDGET_BYTES;
pub use js_runtime::DEFAULT_TIME_BUDGET_MS;
pub use js_runtime::ENV_PRESAVE_DURING_FLATTEN;
pub use js_runtime::MAX_INSTANCES_PER_SUBFORM;
pub use js_runtime::MAX_MUTATIONS_PER_DOC;
pub use js_runtime::MAX_RESOLVE_CALLS_PER_SCRIPT;
pub use js_runtime::MAX_RESOLVE_RESULTS;
pub use js_runtime::MAX_SCRIPT_BODY_BYTES;
pub use js_runtime::MAX_SOM_DEPTH;
pub use js_runtime::MAX_VARIABLES_SCRIPT_BODY_BYTES;
pub use js_runtime::SANDBOX_ACTIVITY_ALLOWLIST;
pub use formcalc_interpreter as formcalc;
pub use xfa_dom_resolver as dom_resolver;
pub use xfa_json as json;
pub use xfa_layout_engine as layout;

Modules§

appearance_bridge
Appearance stream generation for XFA form fields (internal bridge). FormCalc results -> PDF appearance streams.
classify
XFA form type classification — static vs dynamic vs none.
dynamic
Dynamic XFA script processing — binding, mode selection, and outcome reporting.
error
Error types for the XFA engine.
extract
XFA packet extraction from PDF via pdf-syntax.
flatten
XFA Flattening Pipeline
font_bridge
Font resolution, embedding, and metrics for the XFA flatten pipeline (internal bridge).
image_bridge
Image embedding utilities for the XFA flatten pipeline (internal bridge). Image embedding for PDF XObjects.
javascript_policy
Central JavaScript handling policy for PDF/XFA hardening paths.
js_runtime
M3-B Phase B — JavaScript runtime adapter (skeleton).
merger
XFA Form DOM — the merged result of template + data.
paint_bridge
Paint command abstraction layer between layout and PDF rendering (internal bridge). Abstract paint commands for XFA layout rendering.
render_bridge
PDF content-stream rendering from layout DOM (internal bridge). XFA layout output to PDF content stream overlay generation.
template_parser
XDP template XML → FormTree parser.