Expand description
Parse-once interactive fill session (Phase 1 SDK foundation).
XfaSession — parse-once interactive fill session over an XFA PDF.
Phase 1 SDK foundation: enumerate the currently visible/layouted fields, set values (with write-through to the bound data nodes), and save a PDF whose datasets packet carries the filled values so Adobe Acrobat/Reader reopens the form with them.
Explicit non-goals at this phase (see the UEA gap analysis): no change/click event execution, no dynamic re-layout/reflow after a value write, no instanceManager add/remove, no form-packet structural writes.
use pdf_xfa::session::{XfaSession, XfaWriteValue};
let bytes = std::fs::read("form.pdf").unwrap();
let mut session = XfaSession::open(&bytes).unwrap();
println!("pages: {}", session.page_count());
for f in session.fields() {
println!("{} = {:?}", f.name, f.value);
}
session
.set_value("form1.applicant.name", XfaWriteValue::Text("Alice"))
.unwrap();
let filled = session.save_to_bytes().unwrap();
std::fs::write("filled.pdf", filled).unwrap();Structs§
- XfaField
Model - SDK-level model of one fillable XFA form field, derived from the merged form tree and the current layout.
- XfaField
Option - A selectable option of a dropdown / list field.
- XfaRect
- Axis-aligned rectangle in page space, points, top-left origin (XFA coordinate convention: y grows downward from the top of the page).
- XfaSession
- Parse-once session over a single XFA PDF.
- XfaSet
Outcome - Outcome of a successful
XfaSession::set_valuecall. - XfaWidget
- One layouted widget occurrence of a field.
- XfaWriteback
Report - Report from a save/writeback.
Enums§
- XfaField
Type - Public field type, mirroring
FieldKindwithout leaking the layout-engine type into the SDK surface. - XfaWrite
Value - A value to write into an XFA field.