Skip to main content

Module session

Module session 

Source
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§

XfaFieldModel
SDK-level model of one fillable XFA form field, derived from the merged form tree and the current layout.
XfaFieldOption
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.
XfaSetOutcome
Outcome of a successful XfaSession::set_value call.
XfaWidget
One layouted widget occurrence of a field.
XfaWritebackReport
Report from a save/writeback.

Enums§

XfaFieldType
Public field type, mirroring FieldKind without leaking the layout-engine type into the SDK surface.
XfaWriteValue
A value to write into an XFA field.