Skip to main content

InteractiveForm

Struct InteractiveForm 

Source
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: Alignment

Default quadding/alignment (/Q) — 0=Left, 1=Center, 2=Right.

Implementations§

Source§

impl InteractiveForm

Source

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.

Source

pub fn calculation_order(&self) -> &[String]

Returns the calculation order field names.

Source

pub fn all_fields(&self) -> Vec<&FormField>

Return a flat iterator over all fields (depth-first).

Source

pub fn field_by_name(&self, name: &str) -> Option<&FormField>

Find a field by its fully qualified name.

Source

pub fn field_by_name_mut(&mut self, name: &str) -> Option<&mut FormField>

Find a field by its fully qualified name (mutable).

Source

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.

Source

pub fn default_appearance(&self) -> Option<&str>

Return the default appearance string (/DA) from the AcroForm dictionary.

Source

pub fn get_default_appearance(&self) -> Option<&str>

ADR-019 alias for default_appearance().

Corresponds to CPDF_InteractiveForm::GetDefaultAppearance() in PDFium.

Source

pub fn default_alignment(&self) -> Alignment

Return the default alignment (/Q) from the AcroForm dictionary.

Source

pub fn get_form_alignment(&self) -> Alignment

ADR-019 alias for default_alignment().

Corresponds to CPDF_InteractiveForm::GetFormAlignment() in PDFium.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> InteractiveForm

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InteractiveForm

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more