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>
impl<'a, R: Read + Seek> FormFieldObjectHelper<'a, R>
Sourcepub fn new(field_ref: ObjectRef, pdf: &'a mut Pdf<R>) -> Self
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.
Sourcepub fn from_object_handle(field: ObjectHandle, pdf: &'a mut Pdf<R>) -> Self
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.
Sourcepub fn is_null(&mut self) -> Result<bool>
pub fn is_null(&mut self) -> Result<bool>
Return whether the referenced field object is PDF null.
Sourcepub fn parent(&mut self) -> Result<Option<ObjectRef>>
pub fn parent(&mut self) -> Result<Option<ObjectRef>>
Return this field’s direct /Parent reference, if present.
Sourcepub fn get_parent(&mut self) -> Result<ObjectHandle>
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.
Sourcepub fn get_top_level_field(&mut self) -> Result<(ObjectHandle, bool)>
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.
Sourcepub fn get_inheritable_field_value(
&mut self,
key: &[u8],
) -> Result<Option<ObjectHandle>>
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.
Sourcepub fn get_inheritable_field_value_as_string(
&mut self,
key: &[u8],
) -> Result<String>
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.
Sourcepub fn get_inheritable_field_value_as_name(
&mut self,
key: &[u8],
) -> Result<Vec<u8>>
pub fn get_inheritable_field_value_as_name( &mut self, key: &[u8], ) -> Result<Vec<u8>>
Return an inheritable PDF name with its leading slash.
Sourcepub fn get_field_type(&mut self) -> Result<Option<Vec<u8>>>
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.
Sourcepub fn field_value(&mut self) -> Result<Option<ObjectHandle>>
pub fn field_value(&mut self) -> Result<Option<ObjectHandle>>
Return the inheritable /V field value without discarding indirect
identity.
Sourcepub fn field_value_handle(&mut self) -> Result<Option<ObjectHandle>>
pub fn field_value_handle(&mut self) -> Result<Option<ObjectHandle>>
Return the inheritable /V handle.
Sourcepub fn field_value_reference(&mut self) -> Result<Option<ObjectRef>>
pub fn field_value_reference(&mut self) -> Result<Option<ObjectRef>>
Return the indirect object reference selected by inherited /V.
Sourcepub fn field_default_value(&mut self) -> Result<Option<ObjectHandle>>
pub fn field_default_value(&mut self) -> Result<Option<ObjectHandle>>
Return the inheritable /DV field default value without discarding
indirect identity.
Sourcepub fn field_default_value_handle(&mut self) -> Result<Option<ObjectHandle>>
pub fn field_default_value_handle(&mut self) -> Result<Option<ObjectHandle>>
Return the inheritable /DV handle.
Sourcepub fn get_value(&mut self) -> Result<Option<ObjectHandle>>
pub fn get_value(&mut self) -> Result<Option<ObjectHandle>>
Return the inheritable /V field value.
Sourcepub fn get_value_as_string(&mut self) -> Result<String>
pub fn get_value_as_string(&mut self) -> Result<String>
Return the inheritable /V as qpdf-style UTF-8 text.
Sourcepub fn get_default_value(&mut self) -> Result<Option<ObjectHandle>>
pub fn get_default_value(&mut self) -> Result<Option<ObjectHandle>>
Return the inheritable /DV field default value.
Sourcepub fn get_default_value_as_string(&mut self) -> Result<String>
pub fn get_default_value_as_string(&mut self) -> Result<String>
Return the inheritable /DV as qpdf-style UTF-8 text.
Sourcepub fn field_flags(&mut self) -> Result<Option<i64>>
pub fn field_flags(&mut self) -> Result<Option<i64>>
Return the inheritable /Ff field flags.
Sourcepub fn get_flags(&mut self) -> Result<i64>
pub fn get_flags(&mut self) -> Result<i64>
Return the inheritable /Ff flags, defaulting to zero.
Sourcepub fn get_partial_name(&mut self) -> Result<String>
pub fn get_partial_name(&mut self) -> Result<String>
Return this field’s /T partial name as qpdf-style UTF-8 text.
Sourcepub fn get_fully_qualified_name(&mut self) -> Result<String>
pub fn get_fully_qualified_name(&mut self) -> Result<String>
Return the dotted /T name formed by this field and its parents.
Sourcepub fn get_alternative_name(&mut self) -> Result<String>
pub fn get_alternative_name(&mut self) -> Result<String>
Return /TU, or the fully qualified name when /TU is absent.
Sourcepub fn get_mapping_name(&mut self) -> Result<String>
pub fn get_mapping_name(&mut self) -> Result<String>
Return /TM, then /TU, then the fully qualified name.
Sourcepub fn get_default_appearance(&mut self) -> Result<String>
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.
Sourcepub fn get_default_resources(&mut self) -> Result<Option<ObjectHandle>>
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.
Sourcepub fn get_quadding(&mut self) -> Result<i64>
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.
Sourcepub fn is_checkbox(&mut self) -> Result<bool>
pub fn is_checkbox(&mut self) -> Result<bool>
Return whether this field is a checkbox button.
Sourcepub fn is_checked(&mut self) -> Result<bool>
pub fn is_checked(&mut self) -> Result<bool>
Return whether this checkbox has an on-state value.
Return whether this field is a radio button (/Btn, flag bit 16).
Return whether this field is a pushbutton (/Btn, flag bit 17).
Sourcepub fn is_choice(&mut self) -> Result<bool>
pub fn is_choice(&mut self) -> Result<bool>
Return whether this field is a choice field (/FT /Ch).
Sourcepub fn get_choices(&mut self) -> Result<Vec<String>>
pub fn get_choices(&mut self) -> Result<Vec<String>>
Return qpdf’s choice labels for a choice field.
Sourcepub fn set_field_attribute(
&mut self,
key: &[u8],
value: ObjectHandle,
) -> Result<()>
pub fn set_field_attribute( &mut self, key: &[u8], value: ObjectHandle, ) -> Result<()>
Replace a direct attribute on this field dictionary.
Sourcepub fn set_field_attribute_string(
&mut self,
key: &[u8],
value: &str,
) -> Result<()>
pub fn set_field_attribute_string( &mut self, key: &[u8], value: &str, ) -> Result<()>
Replace a direct string attribute using qpdf’s Unicode-string encoding.
Sourcepub fn set_value(
&mut self,
value: ObjectHandle,
need_appearances: bool,
) -> Result<()>
pub fn set_value( &mut self, value: ObjectHandle, need_appearances: bool, ) -> Result<()>
Set the field’s /V value using qpdf’s form-field dispatch.
Sourcepub fn set_value_string(
&mut self,
value: &str,
need_appearances: bool,
) -> Result<()>
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.
Sourcepub fn generate_appearance_for(
&mut self,
widget_ref: ObjectRef,
) -> Result<Option<ObjectRef>>
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.
Sourcepub fn clear_need_appearances_after_generation(pdf: &mut Pdf<R>) -> Result<()>
pub fn clear_need_appearances_after_generation(pdf: &mut Pdf<R>) -> Result<()>
Clear /AcroForm/NeedAppearances after a document appearance pass.