pub struct InteractiveForm {
pub fields: Vec<FormField>,
pub calculation_order: Vec<String>,
pub default_appearance: Option<String>,
pub default_alignment: Alignment,
}Expand description
A parsed interactive form (AcroForm).
Fields§
§fields: Vec<FormField>Top-level form fields (may contain children for hierarchical fields).
calculation_order: Vec<String>Calculation order — field names in the order they should be calculated.
default_appearance: Option<String>Default appearance string (/DA) from the AcroForm dictionary.
default_alignment: AlignmentDefault quadding/alignment (/Q) — 0=Left, 1=Center, 2=Right.
Implementations§
Source§impl InteractiveForm
impl InteractiveForm
Sourcepub fn from_catalog<S: PdfSource>(
catalog: &Object,
store: &ObjectStore<S>,
) -> DocResult<Option<Self>>
pub fn from_catalog<S: PdfSource>( catalog: &Object, store: &ObjectStore<S>, ) -> DocResult<Option<Self>>
Parse the interactive form from the document catalog.
Returns None if no /AcroForm dictionary is present.
Field trees are traversed iteratively for WASM safety.
Sourcepub fn calculation_order(&self) -> &[String]
pub fn calculation_order(&self) -> &[String]
Returns the calculation order field names.
Sourcepub fn all_fields(&self) -> Vec<&FormField>
pub fn all_fields(&self) -> Vec<&FormField>
Return a flat iterator over all fields (depth-first).
Sourcepub fn field_by_name(&self, name: &str) -> Option<&FormField>
pub fn field_by_name(&self, name: &str) -> Option<&FormField>
Find a field by its fully qualified name.
Sourcepub fn field_by_name_mut(&mut self, name: &str) -> Option<&mut FormField>
pub fn field_by_name_mut(&mut self, name: &str) -> Option<&mut FormField>
Find a field by its fully qualified name (mutable).
Sourcepub fn all_field_names(&self) -> Vec<String>
pub fn all_field_names(&self) -> Vec<String>
Collect all field names in depth-first order.
This can be combined with Self::field_by_name_mut to iterate mutably.
Sourcepub fn default_appearance(&self) -> Option<&str>
pub fn default_appearance(&self) -> Option<&str>
Return the default appearance string (/DA) from the AcroForm dictionary.
Sourcepub fn get_default_appearance(&self) -> Option<&str>
pub fn get_default_appearance(&self) -> Option<&str>
ADR-019 alias for default_appearance().
Corresponds to CPDF_InteractiveForm::GetDefaultAppearance() in PDFium.
Sourcepub fn default_alignment(&self) -> Alignment
pub fn default_alignment(&self) -> Alignment
Return the default alignment (/Q) from the AcroForm dictionary.
Sourcepub fn get_form_alignment(&self) -> Alignment
pub fn get_form_alignment(&self) -> Alignment
ADR-019 alias for default_alignment().
Corresponds to CPDF_InteractiveForm::GetFormAlignment() in PDFium.
Sourcepub fn check_required_fields(&self) -> Vec<&str>
pub fn check_required_fields(&self) -> Vec<&str>
Check which required fields have empty values.
Returns the names of fields that have the Required flag (bit 2) set but have no value.
Sourcepub fn control_at_point(&self, x: f64, y: f64) -> Option<(&str, usize)>
pub fn control_at_point(&self, x: f64, y: f64) -> Option<(&str, usize)>
Find a form control (widget) at the given point.
Returns the field name and control index if a control’s rect contains (x, y).
Corresponds to CPDF_InteractiveForm::GetControlAtPoint() in PDFium.
Sourcepub fn get_control_at_point(&self, x: f64, y: f64) -> Option<(&str, usize)>
pub fn get_control_at_point(&self, x: f64, y: f64) -> Option<(&str, usize)>
ADR-019 alias for control_at_point().
Corresponds to CPDF_InteractiveForm::GetControlAtPoint() in PDFium.
Trait Implementations§
Source§impl Clone for InteractiveForm
impl Clone for InteractiveForm
Source§fn clone(&self) -> InteractiveForm
fn clone(&self) -> InteractiveForm
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more