pub struct Widget {
pub rect: Rectangle,
pub appearance: WidgetAppearance,
pub parent: Option<String>,
pub appearance_streams: Option<AppearanceDictionary>,
}Expand description
Widget annotation for form field
Fields§
§rect: RectangleRectangle for widget position
appearance: WidgetAppearanceAppearance settings
parent: Option<String>Parent field reference (will be set by FormManager)
appearance_streams: Option<AppearanceDictionary>Appearance streams (Normal, Rollover, Down)
Implementations§
Source§impl Widget
impl Widget
Sourcepub fn with_appearance(self, appearance: WidgetAppearance) -> Self
pub fn with_appearance(self, appearance: WidgetAppearance) -> Self
Set appearance
Sourcepub fn with_appearance_streams(self, streams: AppearanceDictionary) -> Self
pub fn with_appearance_streams(self, streams: AppearanceDictionary) -> Self
Set appearance streams
Sourcepub fn generate_appearance(
&mut self,
field_type: FieldType,
value: Option<&str>,
) -> Result<()>
pub fn generate_appearance( &mut self, field_type: FieldType, value: Option<&str>, ) -> Result<()>
Generate default appearance streams based on field type.
Backwards-compatible entry point — delegates to
[generate_appearance_with_font] without any custom-font context.
Emits Helvetica + WinAnsi by default, so non-WinAnsi values fail with
PdfError::EncodingError. Callers that need CJK, Arabic, or other
scripts must use the _with_font variant (typically via
Document::fill_field, which routes through it automatically).
Sourcepub fn generate_appearance_with_font(
&mut self,
field_type: FieldType,
value: Option<&str>,
default_appearance: Option<&DefaultAppearance>,
custom_font: Option<&Font>,
) -> Result<HashMap<String, HashSet<char>>>
pub fn generate_appearance_with_font( &mut self, field_type: FieldType, value: Option<&str>, default_appearance: Option<&DefaultAppearance>, custom_font: Option<&Font>, ) -> Result<HashMap<String, HashSet<char>>>
Generate appearance streams honouring an optional /DA and an
optional pre-resolved custom (Type0) font.
Returns the per-font character accumulator produced by the Type0 path
— an empty map for the built-in path — so the caller can merge it
into Document::used_characters_by_font (subsetter invariant, issue
#204).
Sourcepub fn to_annotation_dict(&self) -> Dictionary
pub fn to_annotation_dict(&self) -> Dictionary
Convert to annotation dictionary