import { ObjectManager } from "../../ObjectManager"; import { Field, type FieldBaseProperties } from "./Field"; import { WidgetAnnotation, type WidgetProperties } from "../Annotations/WidgetAnnotation"; import { type Rect } from "../../Types"; import { type PdfPage } from "../PdfPage"; /** * Defines common properties for {@link TextField} and {@link CombTextField}. */ export type TextFieldBaseProperties = FieldBaseProperties & { /** * Defines the position and dimensions of the field on the page using a bounding rectangle. * * Note: If a widget is specified via the 'widget' property, * its 'rect' value takes precedence and will override this rectangle definition. */ rect?: Rect; /** * The widget annotation defining view properties of the checkbox field. */ widget?: WidgetAnnotation | WidgetProperties; /** * The maximum length of the field's text, in characters. */ maxLen?: number; /** * The value of the field. */ value?: string; /** * The default value of the field, applied when the field is reset. */ defaultValue?: string; /** * Indicating whether the field can contain multiple lines of text. */ multiline?: boolean; /** * Indicating whether the field is intended for entering a secure password that * should not be echoed visibly to the screen. */ password?: boolean; /** * Indicating whether the text entered in the field is spell-checked. */ spellCheck?: boolean; /** * Indicating whether the field is scrollable to accommodate more text than * fits within its annotation rectangle. */ scrollable?: boolean; /** * Indicating whether the value of this field should be represented as a rich text string. */ richText?: boolean; }; /** * Defines properties of a {@link TextField}. */ export type TextFieldProperties = TextFieldBaseProperties & { type: "text"; }; /** * Represents a text field. */ export declare class TextField extends Field { /** * Creates a new {@link TextField}. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link TextField}. */ constructor(om: ObjectManager); /** * Creates a new {@link TextField}. */ constructor(); /** * Gets or sets the rich text to be displayed in the {@link TextField}. * This text can be formatted using HTML tags, see PDF specification for details. * Note that DsPdfJS does not automatically regenerates appearance streams for text fields containing RTF text. */ get richTextValue(): string | null; /** * Gets or sets the rich text to be displayed in the {@link TextField}. * This text can be formatted using HTML tags, see PDF specification for details. * Note that DsPdfJS does not automatically regenerates appearance streams for text fields containing RTF text. */ set richTextValue(value: string | null); /** * Gets or sets the default style string used when the field value is specified using {@link TextField#richTextValue}. * See PDF specification for details. * Note that DsPdfJS does not automatically regenerates appearance streams for text fields containing RTF text. */ get defaultStyleString(): string | null; /** * Gets or sets the default style string used when the field value is specified using {@link TextField#richTextValue}. * See PDF specification for details. * Note that DsPdfJS does not automatically regenerates appearance streams for text fields containing RTF text. */ set defaultStyleString(value: string | null); /** * Gets the {@link WidgetAnnotation} defining view properties of the text field. */ get widget(): WidgetAnnotation; /** * Gets or sets the {@link PdfPage} containing this field. * This property wraps the {@link WidgetAnnotation#page} property * and functions identically to: * this.widget.page = value; * * Note that a field may have multiple associated annotations across different pages. * These can be added and configured using the {@link Field@widgets} property. * * @see {@link WidgetAnnotation#page} */ get page(): PdfPage | null; /** * Gets or sets the {@link PdfPage} containing this field. * This property wraps the {@link WidgetAnnotation#page} property * and functions identically to: * this.widget.page = value; * * Note that a field may have multiple associated annotations across different pages. * These can be added and configured using the {@link Field@widgets} property. * * @see {@link WidgetAnnotation#page} */ set page(value: PdfPage | null); /** * Gets or sets the rectangle that defines the location and size of the field on a page. * This property wraps the {@link WidgetAnnotation#rect} property * and functions identically to: * this.widget.rect = value; * * Note that a field may have multiple associated annotations across different pages. * These can be added and configured using the {@link Field@widgets} property. * * @see {@link WidgetAnnotation#rect} */ get rect(): Rect; /** * Gets or sets the rectangle that defines the location and size of the field on a page. * This property wraps the {@link WidgetAnnotation#rect} property * and functions identically to: * this.widget.rect = value; * * Note that a field may have multiple associated annotations across different pages. * These can be added and configured using the {@link Field@widgets} property. * * @see {@link WidgetAnnotation#rect} */ set rect(value: Rect); /** * Gets or sets the maximum length of the field's text, in characters. */ get maxLen(): number; /** * Gets or sets the maximum length of the field's text, in characters. */ set maxLen(value: number); /** * Gets or sets the text of {@link TextField}. */ get text(): string | null; /** * Gets or sets the text of {@link TextField}. */ set text(value: string | null); /** * Gets or sets the default text of this {@link TextField}, * applied when the field is reset. */ get defaultText(): string | null; /** * Gets or sets the default text of this {@link TextField}, * applied when the field is reset. */ set defaultText(value: string | null); /** * Gets or sets a value indicating whether the field can contain multiple lines of text. */ get multiline(): boolean; /** * Gets or sets a value indicating whether the field can contain multiple lines of text. */ set multiline(value: boolean); /** * Gets or sets a value indicating whether the field is intended for entering a secure password that * should not be echoed visibly to the screen. */ get password(): boolean; /** * Gets or sets a value indicating whether the field is intended for entering a secure password that * should not be echoed visibly to the screen. */ set password(value: boolean); /** * Gets or sets a value indicating whether the text entered in the field is spell-checked. */ get spellCheck(): boolean; /** * Gets or sets a value indicating whether the text entered in the field is spell-checked. */ set spellCheck(value: boolean); /** * Gets or sets a value indicating whether the field is scrollable to accommodate more text than * fits within its annotation rectangle. */ get scrollable(): boolean; /** * Gets or sets a value indicating whether the field is scrollable to accommodate more text than * fits within its annotation rectangle. */ set scrollable(value: boolean); /** * Gets or sets a value indicating whether the value of this field should be represented as a rich text string. */ get richText(): boolean; /** * Gets or sets a value indicating whether the value of this field should be represented as a rich text string. */ set richText(value: boolean); }