import { ObjectManager } from "../../ObjectManager"; import { Field, type FieldBaseProperties } from "./Field"; import { WidgetAnnotation, type WidgetProperties } from "../Annotations/WidgetAnnotation"; import { type Rect } from "../../Types"; import { CheckStyle } from "../../Enums"; import { type PdfPage } from "../PdfPage"; /** * Defines properties of a {@link CheckBoxField}. */ export type CheckBoxFieldProperties = FieldBaseProperties & { type: "checkbox"; /** * 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 value as a Boolean value. * Note, if both {@link FieldBaseProperties#value} and 'checked' are specified then * 'checked' preffered. */ checked?: boolean; /** * The default value as a Boolean value. * Note, if both {@link FieldBaseProperties#defaultValue} and 'defaultChecked' are specified then * 'defaultChecked' preffered. */ defaultChecked?: boolean; /** * The style of check mark. * * Note: If a widget is specified via the 'widget' property, * its 'checkStyle' value takes precedence and will override this definition. */ checkStyle?: CheckStyle; }; /** * Represents CheckBox AcroForm field. */ export declare class CheckBoxField extends Field { /** * Creates a new {@link CheckBoxField}. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link CheckBoxField}. */ constructor(om: ObjectManager); /** * Creates a new {@link CheckBoxField}. */ constructor(); /** * Checks whether this {@link CheckBoxField} actually behaves as a {@link RadioButtonField}. * This situation takes place if the checkbox field owns more than one {@link WidgetAnnotation}s, * and the widgets' appearance streams used to show checked state have different names. * * @returns - "true" if this checkbox behaves as a radio button, "false" otherwise. */ get hasRadioButtonBehavior(): boolean; /** * Gets the {@link WidgetAnnotation} defining view properties of the {@link CheckBoxField}. */ 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 style of check mark that is used by this {@link CheckBoxField}. * This property wraps the {@link WidgetAnnotation#checkStyle} property * and functions identically to: * this.widget.checkStyle = 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#checkStyle} */ get checkStyle(): CheckStyle | null; /** * Gets or sets the style of check mark that is used by this {@link CheckBoxField}. * This property wraps the {@link WidgetAnnotation#checkStyle} property * and functions identically to: * this.widget.checkStyle = 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#checkStyle} */ set checkStyle(value: CheckStyle); /** * Gets or sets the object value of this checkbox field. * * Gets "false" if none of the associated widgets is checked. * Otherwise gets "true" if all widgets use the same name for the checked appearance stream, * or the name of the appearance stream that is used to display the checked state. * * When set, if a Boolean value is specified, it is assigned as is to the checked state. * If the assigned value is not a Boolean, it is converted to string and is interpreted * as the name of the widget's appearance stream used to show the widget's checked state. * If no such stream exists, the checkbox will show as unchecked. * * @see {@link checked} * @see {@link hasRadioButtonBehavior} */ get value(): number | string | boolean | number[] | null; /** * Gets or sets the object value of this checkbox field. * * Gets "false" if none of the associated widgets is checked. * Otherwise gets "true" if all widgets use the same name for the checked appearance stream, * or the name of the appearance stream that is used to display the checked state. * * When set, if a Boolean value is specified, it is assigned as is to the checked state. * If the assigned value is not a Boolean, it is converted to string and is interpreted * as the name of the widget's appearance stream used to show the widget's checked state. * If no such stream exists, the checkbox will show as unchecked. * * @see {@link checked} * @see {@link hasRadioButtonBehavior} */ set value(value: number | string | boolean | number[] | null); /** * Gets or sets the default value of this {@link CheckBoxField}. * See {@link CheckBoxField#value} for details. * * @see {@link hasRadioButtonBehavior} */ get defaultValue(): number | string | boolean | number[] | null; /** * Gets or sets the default value of this {@link CheckBoxField}. * See {@link CheckBoxField#value} for details. * * @see {@link hasRadioButtonBehavior} */ set defaultValue(value: number | string | boolean | number[] | null); /** * Gets or sets the value of this {@link CheckBoxField} as a Boolean value. * See {@link CheckBoxField#value} for details. * * @see {@link defaultChecked} * @see {@link hasRadioButtonBehavior} */ get checked(): boolean; /** * Gets or sets the value of this {@link CheckBoxField} as a Boolean value. * See {@link CheckBoxField#value} for details. * * @see {@link defaultChecked} * @see {@link hasRadioButtonBehavior} */ set checked(value: boolean); /** * Gets or sets the default value of this {@link CheckBoxField} as a Boolean value. * See {@link CheckBoxField#value} for details. * * @see {@link checked} * @see {@link hasRadioButtonBehavior} */ get defaultChecked(): boolean; /** * Gets or sets the default value of this {@link CheckBoxField} as a Boolean value. * See {@link CheckBoxField#value} for details. * * @see {@link checked} * @see {@link hasRadioButtonBehavior} */ set defaultChecked(value: boolean); }