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
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Widget
impl RefUnwindSafe for Widget
impl Send for Widget
impl Sync for Widget
impl Unpin for Widget
impl UnsafeUnpin for Widget
impl UnwindSafe for Widget
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more