Skip to main content

FormFieldObjectHelper

Struct FormFieldObjectHelper 

Source
pub struct FormFieldObjectHelper<'a, R: Read + Seek + 'static> { /* private fields */ }
Expand description

Typed access helper for a PDF AcroForm field or widget annotation dictionary.

Implementations§

Source§

impl<'a, R: Read + Seek> FormFieldObjectHelper<'a, R>

Source

pub fn new(field_ref: ObjectRef, pdf: &'a mut Pdf<R>) -> Self

Construct a helper for the field at field_ref.

The object is looked up through the document’s canonical registry once; all later access is through this same live handle, matching qpdf’s QPDFFormFieldObjectHelper(QPDFObjectHandle) constructor.

Source

pub fn from_object_handle(field: ObjectHandle, pdf: &'a mut Pdf<R>) -> Self

Construct a helper from a live field handle, preserving direct-object identity for qpdf’s orphan-Widget fallback.

Source

pub fn is_null(&mut self) -> Result<bool>

Return whether the referenced field object is PDF null.

Source

pub fn parent(&mut self) -> Result<Option<ObjectRef>>

Return this field’s direct /Parent reference, if present.

Source

pub fn get_parent(&mut self) -> Result<ObjectHandle>

Return this field’s parent as a live object handle, or a null handle when no parent exists.

Mirrors QPDFFormFieldObjectHelper::getParent (libqpdf/QPDFFormFieldObjectHelper.cc:30-33). Unlike the ref-valued Self::parent projection, this preserves the qpdf helper’s direct object identity for callers that continue traversing the field tree.

Source

pub fn get_top_level_field(&mut self) -> Result<(ObjectHandle, bool)>

Return the qpdf-shaped top-level field as a live handle and whether it differs from this field.

Mirrors QPDFFormFieldObjectHelper::getTopLevelField (libqpdf/QPDFFormFieldObjectHelper.cc:35-46). The returned handle retains its raw QpdfObjGen identity, including generations outside the valid ObjectRef projection.

Source

pub fn get_inheritable_field_value( &mut self, key: &[u8], ) -> Result<Option<ObjectHandle>>

Return an inheritable field value while preserving the selected qpdf-style handle identity.

Source

pub fn get_inheritable_field_value_as_string( &mut self, key: &[u8], ) -> Result<String>

Return an inheritable PDF string as qpdf-style UTF-8 text.

Source

pub fn get_inheritable_field_value_as_name( &mut self, key: &[u8], ) -> Result<Vec<u8>>

Return an inheritable PDF name with its leading slash.

Source

pub fn get_field_type(&mut self) -> Result<Option<Vec<u8>>>

Return the inheritable /FT field type as qpdf-style name bytes, including the leading slash.

Source

pub fn field_value(&mut self) -> Result<Option<ObjectHandle>>

Return the inheritable /V field value without discarding indirect identity.

Source

pub fn field_value_handle(&mut self) -> Result<Option<ObjectHandle>>

Return the inheritable /V handle.

Source

pub fn field_value_reference(&mut self) -> Result<Option<ObjectRef>>

Return the indirect object reference selected by inherited /V.

Source

pub fn field_default_value(&mut self) -> Result<Option<ObjectHandle>>

Return the inheritable /DV field default value without discarding indirect identity.

Source

pub fn field_default_value_handle(&mut self) -> Result<Option<ObjectHandle>>

Return the inheritable /DV handle.

Source

pub fn get_value(&mut self) -> Result<Option<ObjectHandle>>

Return the inheritable /V field value.

Source

pub fn get_value_as_string(&mut self) -> Result<String>

Return the inheritable /V as qpdf-style UTF-8 text.

Source

pub fn get_default_value(&mut self) -> Result<Option<ObjectHandle>>

Return the inheritable /DV field default value.

Source

pub fn get_default_value_as_string(&mut self) -> Result<String>

Return the inheritable /DV as qpdf-style UTF-8 text.

Source

pub fn field_flags(&mut self) -> Result<Option<i64>>

Return the inheritable /Ff field flags.

Source

pub fn get_flags(&mut self) -> Result<i64>

Return the inheritable /Ff flags, defaulting to zero.

Source

pub fn get_partial_name(&mut self) -> Result<String>

Return this field’s /T partial name as qpdf-style UTF-8 text.

Source

pub fn get_fully_qualified_name(&mut self) -> Result<String>

Return the dotted /T name formed by this field and its parents.

Source

pub fn get_alternative_name(&mut self) -> Result<String>

Return /TU, or the fully qualified name when /TU is absent.

Source

pub fn get_mapping_name(&mut self) -> Result<String>

Return /TM, then /TU, then the fully qualified name.

Source

pub fn get_default_appearance(&mut self) -> Result<String>

Return the default appearance string, inheriting /DA from the field tree and then falling back to /AcroForm.

Source

pub fn get_default_resources(&mut self) -> Result<Option<ObjectHandle>>

Return the document-level /AcroForm/DR handle.

qpdf deliberately does not inherit /DR through the field tree.

Source

pub fn get_quadding(&mut self) -> Result<i64>

Return the quadding value, inheriting /Q and then falling back to /AcroForm/Q. Missing or non-integer values are zero as in qpdf.

Source

pub fn is_text(&mut self) -> Result<bool>

Return whether this field is a text field (/FT /Tx).

Source

pub fn is_checkbox(&mut self) -> Result<bool>

Return whether this field is a checkbox button.

Source

pub fn is_checked(&mut self) -> Result<bool>

Return whether this checkbox has an on-state value.

Source

pub fn is_radio_button(&mut self) -> Result<bool>

Return whether this field is a radio button (/Btn, flag bit 16).

Source

pub fn is_pushbutton(&mut self) -> Result<bool>

Return whether this field is a pushbutton (/Btn, flag bit 17).

Source

pub fn is_choice(&mut self) -> Result<bool>

Return whether this field is a choice field (/FT /Ch).

Source

pub fn get_choices(&mut self) -> Result<Vec<String>>

Return qpdf’s choice labels for a choice field.

Source

pub fn set_field_attribute( &mut self, key: &[u8], value: ObjectHandle, ) -> Result<()>

Replace a direct attribute on this field dictionary.

Source

pub fn set_field_attribute_string( &mut self, key: &[u8], value: &str, ) -> Result<()>

Replace a direct string attribute using qpdf’s Unicode-string encoding.

Source

pub fn set_value( &mut self, value: ObjectHandle, need_appearances: bool, ) -> Result<()>

Set the field’s /V value using qpdf’s form-field dispatch.

Source

pub fn set_value_string( &mut self, value: &str, need_appearances: bool, ) -> Result<()>

Set /V from UTF-8 text using qpdf’s Unicode-string encoding.

Source

pub fn generate_appearance_for( &mut self, widget_ref: ObjectRef, ) -> Result<Option<ObjectRef>>

Generate a normal appearance for widget_ref from this field’s value.

Source

pub fn clear_need_appearances_after_generation(pdf: &mut Pdf<R>) -> Result<()>

Clear /AcroForm/NeedAppearances after a document appearance pass.

Auto Trait Implementations§

§

impl<'a, R> !RefUnwindSafe for FormFieldObjectHelper<'a, R>

§

impl<'a, R> !Send for FormFieldObjectHelper<'a, R>

§

impl<'a, R> !Sync for FormFieldObjectHelper<'a, R>

§

impl<'a, R> !UnwindSafe for FormFieldObjectHelper<'a, R>

§

impl<'a, R> Freeze for FormFieldObjectHelper<'a, R>
where &'a mut Pdf<R>: Freeze,

§

impl<'a, R> Unpin for FormFieldObjectHelper<'a, R>
where &'a mut Pdf<R>: Unpin,

§

impl<'a, R> UnsafeUnpin for FormFieldObjectHelper<'a, R>
where &'a mut Pdf<R>: UnsafeUnpin,

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.