import { ObjectManager } from "../../ObjectManager"; import { MarkupAnnotation, type MarkupAnnotationProperties } from "./MarkupAnnotation"; import { type DefaultAppearance } from "./DefaultAppearance"; import { type Offsets } from "../../Types"; import { LineEndingStyle, VariableTextJustification } from "../../Enums"; import { type Point } from "../../Types"; import { type DefaultAppearanceProperties } from "./DefaultAppearance"; /** * Defines the properties of a free text annotation that displays text directly on a page. * Unlike an ordinary text annotation ({@link TextAnnotation}), * a free text annotation has no open or closed state. * Instead of being displayed in a pop-up window, the text is always visible. * @see {@link FreeTextAnnotation} */ export type FreeTextAnnotationProperties = MarkupAnnotationProperties & { type: "freetext"; /** * The apperance that specifies the visual properties (font, font size etc.) used to format * the content of the annotation. * The apperance can be specified as {@link DefaultAppearanceProperties} with set of properties like font, fontSize, foreColor or * as a string as it will be stored in a PDF stream: "/DF0 10 Tf 0 0 0 rg". */ defaultAppearance?: DefaultAppearanceProperties | string; /** * The {@link Offsets} structure that defines * the numerical differences between two rectangles: * the {@link AnnotationBase#rect} and an inner rectangle contained within that rectangle. * The inner rectangle is where the {@link FreeTextAnnotation}'s text should be displayed. * * Note that if this rectangle is not specified then {@link AnnotationBase#rect} * is used as the text rectangle. */ textOffsets?: Offsets; /** * The opacity value to be used in painting the annotation. * This value applies to all visible elements of the annotation in its closed state * (including its background and border) but not to the pop-up window that appears when the annotation is opened. */ opacity?: number; /** * The justification to be used in displaying the annotation's text. * See PDF specification for details. */ justification?: VariableTextJustification; /** * The array of 2 or 3 {@link Point} structures specifying a callout line attached to the free text annotation. * 3 points represent the starting coordinates, the knee point, and the ending coordinates of the line. * 2 points represent the starting and ending coordinates of the line. * The coordinates are in default user space relative to the upper left corner of the page's media box, * with the Y (vertical) coordinates increasing from top to bottom. */ calloutLine?: Point[]; /** * The line width in points. */ lineWidth?: number; /** * The line dash pattern. Null means a solid line. */ lineDashPattern?: number[]; /** * The style of end callout line. */ lineEndStyle?: LineEndingStyle; }; /** * Represents a free text annotation that displays text directly on a page. * Unlike an ordinary text annotation ({@link TextAnnotation}), * a free text annotation has no open or closed state. * Instead of being displayed in a pop-up window, the text is always visible. */ export declare class FreeTextAnnotation extends MarkupAnnotation { /** * Creates a new {@link FreeTextAnnotation}. * * @param om - {@link ObjectManager} that controls the lifetime of the {@link FreeTextAnnotation}. */ constructor(om: ObjectManager); /** * Creates a new {@link FreeTextAnnotation}. */ constructor(); /** * Gets the {@link DefaultAppearance} object that specifies * the visual properties (font, font size etc.) used to format the content of the annotation. */ get defaultAppearance(): DefaultAppearance; /** * Gets or sets the {@link Offsets} structure that defines * the numerical differences between two rectangles: * the {@link AnnotationBase#rect} and an inner rectangle contained within that rectangle. * The inner rectangle is where the {@link FreeTextAnnotation}'s text should be displayed. * * Note that if this rectangle is not specified then {@link AnnotationBase#rect} * is used as the text rectangle. */ get textOffsets(): Offsets | null; /** * Gets or sets the {@link Offsets} structure that defines * the numerical differences between two rectangles: * the {@link AnnotationBase#rect} and an inner rectangle contained within that rectangle. * The inner rectangle is where the {@link FreeTextAnnotation}'s text should be displayed. * * Note that if this rectangle is not specified then {@link AnnotationBase#rect} * is used as the text rectangle. */ set textOffsets(value: Offsets | null); /** * Gets or sets the opacity value to be used in painting the annotation. * This value applies to all visible elements of the annotation in its closed state * (including its background and border) but not to the pop-up window that appears when the annotation is opened. */ get opacity(): number; /** * Gets or sets the opacity value to be used in painting the annotation. * This value applies to all visible elements of the annotation in its closed state * (including its background and border) but not to the pop-up window that appears when the annotation is opened. */ set opacity(value: number); /** * Gets or sets the justification to be used in displaying the annotation's text. * See PDF specification for details. */ get justification(): VariableTextJustification; /** * Gets or sets the justification to be used in displaying the annotation's text. * See PDF specification for details. */ set justification(value: VariableTextJustification); /** * Gets or sets an array of 2 or 3 {@link Point} structures specifying a callout line attached to the free text annotation. * 3 points represent the starting coordinates, the knee point, and the ending coordinates of the line. * 2 points represent the starting and ending coordinates of the line. * The coordinates are in default user space relative to the upper left corner of the page's media box, * with the Y (vertical) coordinates increasing from top to bottom. */ get calloutLine(): Point[] | null; /** * Gets or sets an array of 2 or 3 {@link Point} structures specifying a callout line attached to the free text annotation. * 3 points represent the starting coordinates, the knee point, and the ending coordinates of the line. * 2 points represent the starting and ending coordinates of the line. * The coordinates are in default user space relative to the upper left corner of the page's media box, * with the Y (vertical) coordinates increasing from top to bottom. */ set calloutLine(value: Point[] | null); /** * Gets or sets an array of 2 or 3 {@link Point} structures specifying a callout line attached to the free text annotation. * 3 points represent the starting coordinates, the knee point, and the ending coordinates of the line. * 2 points represent the starting and ending coordinates of the line. * The coordinates are specified in PDF user space. * 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. */ get pdfCalloutLine(): Point[] | null; /** * Gets or sets an array of 2 or 3 {@link Point} structures specifying a callout line attached to the free text annotation. * 3 points represent the starting coordinates, the knee point, and the ending coordinates of the line. * 2 points represent the starting and ending coordinates of the line. * The coordinates are specified in PDF user space. * 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. */ set pdfCalloutLine(value: Point[] | null); /** * Gets or sets the line width in points. */ get lineWidth(): number; /** * Gets or sets the line width in points. */ set lineWidth(value: number); /** * Gets or sets the line dash pattern. Null means a solid line. */ get lineDashPattern(): number[] | null; /** * Gets or sets the line dash pattern. Null means a solid line. */ set lineDashPattern(value: number[] | null); /** * Gets or sets the style of end callout line. */ get lineEndStyle(): LineEndingStyle; /** * Gets or sets the style of end callout line. */ set lineEndStyle(value: LineEndingStyle); }