pub struct TextField {
pub name: String,
pub default_value: Option<String>,
pub value: Option<String>,
pub max_length: Option<i32>,
pub multiline: bool,
pub password: bool,
pub file_select: bool,
pub do_not_spell_check: bool,
pub rich_text: bool,
pub default_appearance: Option<DefaultAppearance>,
}Expand description
Text field for entering text
Fields§
§name: StringField name (unique identifier)
default_value: Option<String>Default value
value: Option<String>Current value
max_length: Option<i32>Maximum length of text
multiline: boolWhether field is multiline
password: boolWhether field is password field
file_select: boolWhether field is file select
do_not_spell_check: boolWhether spellcheck is enabled
rich_text: boolWhether field allows rich text
default_appearance: Option<DefaultAppearance>Typed /DA (default appearance) — drives the font/size/colour used to
regenerate the field’s /AP/N when Document::fill_field is called.
When None, fill_field falls back to Helvetica + WinAnsi (which fails
for any non-WinAnsi value — see issue #212).
Implementations§
Source§impl TextField
impl TextField
Sourcepub fn with_default_appearance(
self,
font: Font,
font_size: f64,
color: Color,
) -> Self
pub fn with_default_appearance( self, font: Font, font_size: f64, color: Color, ) -> Self
Attach a typed default appearance (font, size, colour) that
Document::fill_field will use when regenerating the field’s /AP/N.
Required for non-WinAnsi fills (CJK, Arabic, Cyrillic outside basic
Latin, etc.) — the default built-in Helvetica cannot render those and
fill_field will otherwise return PdfError::EncodingError.
The font must be registered on the Document via
add_font_from_bytes if it’s a Font::Custom(_).
Sourcepub fn with_default_value(self, value: impl Into<String>) -> Self
pub fn with_default_value(self, value: impl Into<String>) -> Self
Set the default value
Sourcepub fn with_value(self, value: impl Into<String>) -> Self
pub fn with_value(self, value: impl Into<String>) -> Self
Set the current value
Sourcepub fn with_max_length(self, length: i32) -> Self
pub fn with_max_length(self, length: i32) -> Self
Set maximum length
Sourcepub fn to_dict(&self) -> Dictionary
pub fn to_dict(&self) -> Dictionary
Convert to field dictionary
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TextField
impl RefUnwindSafe for TextField
impl Send for TextField
impl Sync for TextField
impl Unpin for TextField
impl UnsafeUnpin for TextField
impl UnwindSafe for TextField
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