import type { Rect } from "../../Types"; import { ObjectBase } from "../../ObjectBase"; import type { PdfDateTime } from "../../Types"; import type { AnnotationFlags } from "../../Enums"; import type { PdfDocument } from "../PdfDocument"; import type { AnnotationPagesCollection } from "./AnnotationPagesCollection"; import type { PdfPage } from "../PdfPage"; import type { CaretAnnotationProperties } from "./CaretAnnotation"; import type { SquareAnnotationProperties } from "./SquareAnnotation"; import type { CircleAnnotationProperties } from "./CircleAnnotation"; import type { FileAttachmentAnnotationProperties } from "./FileAttachmentAnnotation"; import type { FreeTextAnnotationProperties } from "./FreeTextAnnotation"; import type { InkAnnotationProperties } from "./InkAnnotation"; import type { LineAnnotationProperties } from "./LineAnnotation"; import type { LinkAnnotationProperties } from "./LinkAnnotation"; import type { PolyLineAnnotationProperties } from "./PolyLineAnnotation"; import type { PolygonAnnotationProperties } from "./PolygonAnnotation"; import type { PopupAnnotationProperties } from "./PopupAnnotation"; import type { RedactAnnotationProperties } from "./RedactAnnotation"; import type { RichMediaAnnotationProperties } from "./RichMediaAnnotation"; import type { SoundAnnotationProperties } from "./SoundAnnotation"; import type { StampAnnotationProperties } from "./StampAnnotation"; import type { TextAnnotationProperties } from "./TextAnnotation"; import type { TextMarkupAnnotationProperties } from "./TextMarkupAnnotation"; import type { WatermarkAnnotationProperties } from "./WatermarkAnnotation"; import type { WidgetAnnotationProperties } from "./WidgetAnnotation"; /** * Defines common properties for all annotations. * @see {@link AnnotationBase} */ export type AnnotationBaseProperties = { /** * The {@link PdfPage} that contains this annotation. */ page?: PdfPage; /** * The rectangle that defines the location and size of the annotation on a page. * The coordinates of the rectangle are relative to the upper left corner of the page's * media box, with the Y (vertical) coordinates increasing from top to bottom. * Note that if the annotation is associated with more than one page, * the media box of the first of those pages is used to calculate the rectangle's location. */ rect?: Rect; /** * The text to be displayed for the annotation or, * if this type of annotation does not display text, * an alternate description of the annotation's contents in human-readable form. * In either case, this text is useful when extracting the document's contents in support of accessibility * to users with disabilities or for other purposes. */ contents?: string; /** * The flags specifying various characteristics of the annotation. */ flags?: AnnotationFlags; /** * The date and time when the annotation was modified. */ modifiedDate?: PdfDateTime; /** * The annotation name, a text string uniquely identifying it among all annotations on its page. */ name?: string; /** * The value indicating whether the annotation can be deleted or its properties (including position and size) can be modified by the user. * However, this flag does not restrict changes to the annotation's contents, such as the value of a form field. * Not specified means false. */ locked?: boolean; /** * Gets or sets a value indicating whether the contents of the annotation can be modified by the user. * This flag does not restrict deletion of the annotation or changes to other annotation properties, * such as position and size. * Not specified means false. */ lockedContents?: boolean; }; /** * The type combining all annotation property types. */ export type AnnotationProperties = CaretAnnotationProperties | SquareAnnotationProperties | CircleAnnotationProperties | FileAttachmentAnnotationProperties | FreeTextAnnotationProperties | InkAnnotationProperties | LineAnnotationProperties | LinkAnnotationProperties | PolyLineAnnotationProperties | PolygonAnnotationProperties | PopupAnnotationProperties | RedactAnnotationProperties | RichMediaAnnotationProperties | SoundAnnotationProperties | StampAnnotationProperties | TextAnnotationProperties | TextMarkupAnnotationProperties | WatermarkAnnotationProperties | WidgetAnnotationProperties; /** * The abstract base class for all PDF annotation types. */ export declare abstract class AnnotationBase extends ObjectBase { /** * Gets or sets the date and time when the annotation was modified. */ get modifiedDate(): PdfDateTime | null; /** * Gets or sets the date and time when the annotation was modified. */ set modifiedDate(value: PdfDateTime | null); /** * Gets or sets the text to be displayed for the annotation or, * if this type of annotation does not display text, * an alternate description of the annotation's contents in human-readable form. * In either case, this text is useful when extracting the document's contents in support of accessibility * to users with disabilities or for other purposes. */ get contents(): string | null; /** * Gets or sets the text to be displayed for the annotation or, * if this type of annotation does not display text, * an alternate description of the annotation's contents in human-readable form. * In either case, this text is useful when extracting the document's contents in support of accessibility * to users with disabilities or for other purposes. */ set contents(value: string | null); /** * Gets or sets the rectangle that defines the location and size of the annotation on a page. * The coordinates of the rectangle are relative to the upper left corner of the page's * media box, with the Y (vertical) coordinates increasing from top to bottom. * Note that if the annotation is associated with more than one page, * the media box of the first of those pages is used to calculate the rectangle's location. */ get rect(): Rect; /** * Gets or sets the rectangle that defines the location and size of the annotation on a page. * The coordinates of the rectangle are relative to the upper left corner of the page's * media box, with the Y (vertical) coordinates increasing from top to bottom. * Note that if the annotation is associated with more than one page, * the media box of the first of those pages is used to calculate the rectangle's location. */ set rect(value: Rect); /** * Gets or sets the rectangle that defines the location and size of the annotation on a page * in PDF user space coordinates. * The positive X axis extends horizontally to the right, and the positive Y axis * extends vertically upward, with the origin usually in the lower left corner of the page. * @see {@link rect} */ get pdfRect(): Rect; /** * Gets or sets the rectangle that defines the location and size of the annotation on a page * in PDF user space coordinates. * The positive X axis extends horizontally to the right, and the positive Y axis * extends vertically upward, with the origin usually in the lower left corner of the page. * @see {@link rect} */ set pdfRect(value: Rect); /** * Gets or sets the flags specifying various characteristics of the annotation. */ get flags(): AnnotationFlags; /** * Gets or sets the flags specifying various characteristics of the annotation. */ set flags(value: AnnotationFlags); /** * Gets the {@link PdfDocument} owning this annotation. */ get doc(): PdfDocument | null; /** * Gets the list of pages that reference this annotation. */ get pages(): AnnotationPagesCollection; /** * Gets or sets the {@link PdfPage} that contains this annotation. * Note that an annotation may be referenced by several pages. * In that case this property returns the first element in the * {@link pages} collection. * When setting this property, the following applies: * If the new value is null, this annotation is removed from all pages. * Otherwise, this annotation is assigned exclusively to the specified page. */ get page(): PdfPage | null; /** * Gets or sets the {@link PdfPage} that contains this annotation. * Note that an annotation may be referenced by several pages. * In that case this property returns the first element in the * {@link pages} collection. * When setting this property, the following applies: * If the new value is null, this annotation is removed from all pages. * Otherwise, this annotation is assigned exclusively to the specified page. */ set page(value: PdfPage | null); /** * Gets or sets the annotation name, a text string uniquely identifying it among all annotations on its page. */ get name(): string | null; /** * Gets or sets the annotation name, a text string uniquely identifying it among all annotations on its page. */ set name(value: string | null); /** * Gets or sets a value indicating whether the annotation can be deleted or its properties (including position and size) can be modified by the user. * However, this flag does not restrict changes to the annotation's contents, such as the value of a form field. */ get locked(): boolean; /** * Gets or sets a value indicating whether the annotation can be deleted or its properties (including position and size) can be modified by the user. * However, this flag does not restrict changes to the annotation's contents, such as the value of a form field. */ set locked(value: boolean); /** * Gets or sets a value indicating whether the contents of the annotation can be modified by the user. * This flag does not restrict deletion of the annotation or changes to other annotation properties, * such as position and size. */ get lockedContents(): boolean; /** * Gets or sets a value indicating whether the contents of the annotation can be modified by the user. * This flag does not restrict deletion of the annotation or changes to other annotation properties, * such as position and size. */ set lockedContents(value: boolean); /** * Forces regeneration of the annotation's appearance streams * next time the document is saved. */ resetAppearance(): void; /** * Removes all appearance streams associated with the current annotation, * and disables generation of appearance steams for this annotation when the document is saved. * * Note that if any property affecting the annotation's appearance 'rect' is then changed, * the appearance streams will be regenerated. So this method would usually be called after * initializing all annotation's properties. */ removeAppearance(): void; }