@syncfusion/ej2-pdf
Version:
Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.
10,055 lines • 394 kB
TypeScript
import { _PdfCrossReference } from './../pdf-cross-reference';
import { PdfPage, PdfDestination } from './../pdf-page';
import { _PdfDictionary, _PdfReference } from './../pdf-primitives';
import { PdfFormFieldVisibility, PdfAnnotationFlag, PdfBorderStyle, PdfHighlightMode, PdfLineCaptionType, PdfLineEndingStyle, PdfLineIntent, PdfRotationAngle, PdfTextAlignment, PdfBorderEffectStyle, PdfMeasurementUnit, _PdfGraphicsUnit, PdfCircleMeasurementType, PdfRubberStampAnnotationIcon, PdfCheckBoxStyle, PdfTextMarkupAnnotationType, PdfPopupIcon, PdfAnnotationState, PdfAnnotationStateModel, PdfAttachmentIcon, PdfAnnotationIntent, _PdfAnnotationType, PdfBlendMode, DataFormat } from './../enumerator';
import { PdfField, _PdfDefaultAppearance, PdfListBoxField } from './../form/field';
import { PdfTemplate } from './../graphics/pdf-template';
import { PdfBrush, PdfGraphics, PdfPen, _PdfTransformationMatrix } from './../graphics/pdf-graphics';
import { PdfPath } from './../graphics/pdf-path';
import { PdfStandardFont, PdfFont, PdfFontStyle } from './../fonts/pdf-standard-font';
import { PdfStringFormat } from './../fonts/pdf-string-format';
import { PdfDocument } from './../pdf-document';
import { PdfAppearance } from './pdf-appearance';
import { PdfPopupAnnotationCollection } from './annotation-collection';
import { _PdfPaddings } from './pdf-paddings';
import { PdfLayer } from '../layers/layer';
import { Rectangle, Point, PdfColor, Size } from './../pdf-type';
/**
* Represents the base class for annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access first page
* let page: PdfPage = document.getPage(0);
* // Access the annotation at index 0
* let annotation: PdfAnnotation = page.annotations.at(0);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
export declare abstract class PdfAnnotation {
/**
* Indicates whether this annotation was imported from an existing document.
*
* @private
*/
_isImported: boolean;
/**
* Holds the underlying annotation dictionary used for serialization.
*
* @private
*/
_dictionary: _PdfDictionary;
/**
* Provides access to the cross-reference table for object resolution.
*
* @private
*/
_crossReference: _PdfCrossReference;
/**
* Stores the reference to this annotation in the cross-reference table.
*
* @private
*/
_ref: _PdfReference;
/**
* References the page to which this annotation is associated.
*
* @private
*/
_page: PdfPage;
/**
* Specifies whether the annotation was loaded from an existing document.
*
* @private
*/
_isLoaded: boolean;
/**
* Indicates whether an appearance stream has been explicitly set.
*
* @private
*/
_setAppearance: boolean;
/**
* Flags whether the annotation is currently being exported.
*
* @private
*/
_isExport: boolean;
/**
* Defines the border or content color of the annotation.
*
* @private
*/
_color: PdfColor;
/**
* Stores the annotation flags that define behavior and visibility.
*
* @private
*/
_annotFlags: PdfAnnotationFlag;
/**
* Represents the bounding rectangle of the annotation.
*
* @private
*/
_bounds: Rectangle;
/**
* Specifies the interior color for applicable annotation types.
*
* @private
*/
_innerColor: PdfColor;
/**
* Controls the transparency level of the annotation appearance.
*
* @private
*/
_opacity: number;
/**
* Holds the primary text associated with the annotation.
*
* @private
*/
_text: string;
/**
* Stores an optional value or content string for the annotation.
*
* @private
*/
_value: string;
/**
* Indicates whether the annotation location has been programmatically moved.
*
* @private
*/
_locationDisplaced: boolean;
/**
* Tracks whether bounds have been set or updated.
*
* @private
*/
_isBounds: boolean;
/**
* Manages the border effect (e.g., cloudy) applied to the annotation.
*
* @private
*/
_borderEffect: PdfBorderEffect;
/**
* Stores the default appearance information for text rendering.
*
* @private
*/
_da: _PdfDefaultAppearance;
/**
* Specifies the rotation applied to the annotation content.
*
* @private
*/
_rotate: PdfRotationAngle;
/**
* When true, applies rotation to all relevant elements of the annotation.
*
* @private
*/
_isAllRotation: boolean;
/**
* Holds the font used when rendering annotation text.
*
* @private
*/
_pdfFont: PdfFont;
/**
* Provides a custom appearance template for the annotation.
*
* @private
*/
_appearanceTemplate: PdfTemplate;
/**
* Determines whether the annotation should be flattened when saved.
*
* @private
*/
_flatten: boolean;
private _ratio;
private _author;
private _border;
private _caption;
private _creationDate;
private _modifiedDate;
private _name;
private _subject;
/**
* Identifies whether the annotation is a widget (form field) annotation.
*
* @private
*/
_isWidget: boolean;
/**
* Holds the internal annotation type discriminator.
*
* @private
*/
_type: _PdfAnnotationType;
/**
* Indicates whether popups associated with this annotation should be flattened.
*
* @private
*/
_isFlattenPopups: boolean;
/**
* Maintains the collection of comment popups attached to this annotation.
*
* @private
*/
_comments: PdfPopupAnnotationCollection;
/**
* Tracks the review history popups linked to this annotation.
*
* @private
*/
_reviewHistory: PdfPopupAnnotationCollection;
/**
* Default font used for popup content rendering.
*
* @private
*/
_popUpFont: PdfStandardFont;
/**
* Bold font used for author text in popups.
*
* @private
*/
_authorBoldFont: PdfStandardFont;
/**
* Font used for line caption text.
*
* @private
*/
_lineCaptionFont: PdfStandardFont;
/**
* Font used for circle caption text.
*
* @private
*/
_circleCaptionFont: PdfStandardFont;
/**
* Indicates whether the color used should be treated as transparent.
*
* @private
*/
_isTransparentColor: boolean;
/**
* Tracks whether the annotation has been rotated.
*
* @private
*/
_isRotated: boolean;
/**
* Flags if any property of the annotation has changed.
*
* @private
*/
_isChanged: boolean;
private _layer;
/**
* Stores the quad points for text markup annotations.
*
* @private
*/
_quadPoints: Array<number>;
/**
* Holds multiple bounding rectangles for complex annotations.
*
* @private
*/
_boundsCollection: Array<Rectangle>;
/**
* Keeps geometric points used by the annotation (e.g., vertices).
*
* @private
*/
_points: Point[];
/**
* Caches custom appearance templates keyed by usage.
*
* @private
*/
_customTemplate: Map<string, PdfTemplate>;
/**
* Indicates whether the annotation text was updated.
*
* @private
*/
_isTextUpdated: boolean;
/**
* Gets the author of the annotation.
*
* @returns {string} Author.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* //Get the author of the annotation.
* let author: string = annotation.author;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the author of the annotation.
*
* @param {string} value Author.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the author of the annotation.
* annotation.author = 'Syncfusion';
* // Destroy the document
* document.destroy();
* ```
*/
author: string;
/**
* Gets the border of the annotation.
*
* @returns {PdfAnnotationBorder} Annotation border.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the border of the annotation.
* let border: PdfAnnotationBorder = annotation.border;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the border of the annotation.
*
* @param {PdfAnnotationBorder} value Border.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Initializes a new instance of the `PdfAnnotationBorder` class.
* let border: PdfAnnotationBorder = new PdfAnnotationBorder();
* //Sets the width of the annotation border.
* border.width = 10;
* //Sets the style of the annotation border.
* border.style = PdfBorderStyle.dashed;
* //Sets the dash pattern of the annotation border.
* border.dash = [1, 2, 1];
* // Sets the border to the PDF annotation
* annotation.border = border;
* // Destroy the document
* document.destroy();
* ```
*/
border: PdfAnnotationBorder;
/**
* Gets the flags of the annotation.
*
* @returns {PdfAnnotationFlag} Annotation flag.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the flags of the annotation.
* let flag: PdfAnnotationFlag = annotation.flags;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the flags of the annotation.
*
* @param {PdfAnnotationFlag} value flag value.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the flags of the annotation.
* annotation.flags = PdfAnnotationFlag.print;
* // Destroy the document
* document.destroy();
* ```
*/
flags: PdfAnnotationFlag;
/**
* Gets the fore color of the annotation.
*
* @returns {PdfColor} R, G, B color values in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the color of the annotation.
* let color: PdfColor = annotation.color;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the fore color of the annotation.
*
* @param {PdfColor} value R, G, B color values in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the color of the annotation.
* annotation.color = {r: 255, g: 0, b: 0};
* // Destroy the document
* document.destroy();
* ```
*/
color: PdfColor;
/**
* Gets the inner color of the annotation.
*
* @returns {PdfColor} R, G, B color values in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the inner color of the annotation.
* let innerColor: PdfColor = annotation.innerColor;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the inner color of the annotation.
*
* @param {PdfColor} value R, G, B color values in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the inner color of the annotation.
* annotation.innerColor = {r: 255, g: 0, b: 0};
* // Destroy the document
* document.destroy();
* ```
*/
innerColor: PdfColor;
/**
* Gets the creation date of the annotation.
*
* @returns {Date} Creation date.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* //Get the creation date of the annotation.
* let creationDate: Date = annotation.creationDate;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the creation date of the annotation.
*
* @param {Date} value Creation date.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* //Set the creation date of the annotation.
* annotation.creationDate = new Date();
* // Destroy the document
* document.destroy();
* ```
*/
creationDate: Date;
/**
* Gets the modification date of the annotation.
*
* @returns {Date} Modified date.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* //Get the modified date of the annotation.
* let modifiedDate: Date = annotation.modifiedDate;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the modification date of the annotation.
*
* @param {Date} value Modified date.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* //Set the modified date of the annotation.
* annotation.modifiedDate = new Date();
* // Destroy the document
* document.destroy();
* ```
*/
modifiedDate: Date;
/**
* Gets the bounds of the annotation.
*
* @returns {Rectangle} Bounds.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the bounds of the annotation.
* let bounds: Rectangle = annotation.bounds;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the bounds of the annotation.
*
* @param {Rectangle} value bounds.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the bounds of the annotation.
* annotation.bounds = {x: 10, y: 10, width: 150, height: 5};
* // Destroy the document
* document.destroy();
* ```
*/
bounds: Rectangle;
/**
* Gets the caption of the annotation.
*
* @returns {PdfAnnotationCaption} Annotation caption.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the caption of the annotation.
* let caption: PdfAnnotationCaption = annotation.caption;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the caption of the annotation.
*
* @param {PdfAnnotationCaption} value Annottion caption.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Create and set annotation caption values
* annotation.caption = new PdfAnnotationCaption(true, PdfLineCaptionType.inline, {x: 10, y: 10});
* // Destroy the document
* document.destroy();
* ```
*/
caption: PdfAnnotationCaption;
/**
* Gets the opacity of the annotation.
*
* @returns {number} Opacity in between 0 t0 1.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* //Get the opacity of the annotation.
* let opacity: number = annotation.opacity;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the opacity of the annotation.
*
* @param {number} value opacity in between 0 t0 1.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the opacity of the annotation.
* annotation.opacity = 0.5;
* // Destroy the document
* document.destroy();
* ```
*/
opacity: number;
/**
* Gets the subject of the annotation.
*
* @returns {string} Subject.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* //Get the subject of the annotation.
* let subject: string = annotation.subject;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the subject of the annotation.
*
* @param {string} value Subject.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the subject of the annotation.
* annotation.subject = 'Line Annotation';
* // Destroy the document
* document.destroy();
* ```
*/
subject: string;
/**
* Gets the name of the annotation.
*
* @returns {string} Name.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* //Get the name of the annotation.
* let name: string = annotation.name;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the name of the annotation.
*
* @param {string} value Name.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the name of the annotation.
* annotation.name = 'LineAnnotation';
* // Destroy the document
* document.destroy();
* ```
*/
name: string;
/**
* Gets the text of the annotation.
*
* @returns {string} Text.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* //Get the text of the annotation.
* let text: string = annotation.text;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the text of the annotation.
*
* @param {string} value Text.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the text of the annotation.
* annotation.text = 'LineAnnotation';
* // Destroy the document
* document.destroy();
* ```
*/
text: string;
/**
* Gets the rotation of the annotation.
*
* @returns {PdfRotationAngle} Rotation angle.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* //Get the rotation angle of the annotation.
* let rotationAngle: PdfRotationAngle = annotation.rotationAngle;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the rotation of the annotation.
*
* @param {PdfRotationAngle} value rotation angle.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the rotation angle of the annotation.
* annotation.rotationAngle = PdfRotationAngle.angle180;
* // Destroy the document
* document.destroy();
* ```
*/
rotationAngle: PdfRotationAngle;
/**
* Gets the rotation angle of the annotation (Read only).
*
* @returns {number} Rotation angle.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* //Get the rotation angle of the annotation.
* let rotate: number = annotation.rotate;
* // Destroy the document
* document.destroy();
* ```
*/
readonly rotate: number;
/**
* Gets the boolean flag indicating whether annotations popup have been flattened or not.
*
* @returns {boolean} Flatten Popup.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the boolean flag indicating whether annotations popup have been flattened or not.
* let flattenPopups: boolean = annotation.flattenPopups;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the boolean flag indicating whether the annotations popup have been flattened or not.
*
* @param {boolean} value Flatten Popup.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the boolean flag indicating whether the annotations popup have been flattened or not.
* annotation.flattenPopups = false;
* // Destroy the document
* document.destroy();
* ```
*/
flattenPopups: boolean;
/**
* Gets the boolean flag indicating whether the annotation have been flattened or not.
*
* @returns {boolean} Flatten.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the boolean flag indicating whether the annotation have been flattened or not.
* let flatten: boolean = annotation.flatten;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the boolean flag indicating whether the annotation have been flattened or not.
*
* @param {boolean} value Flatten.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the boolean flag indicating whether the annotation have been flattened or not.
* annotation.flatten = true;
* // Destroy the document
* document.destroy();
* ```
*/
flatten: boolean;
/**
* Indicates whether the annotation dictionary defines flag entries,
* allowing consumers to detect the presence of annotation-level flags.
*
* @private
* @returns {boolean} hasFlags.
*/
readonly _hasFlags: boolean;
/**
* Converts degrees to radians on demand, initializing the cached conversion
* ratio if necessary and returning the precomputed value for reuse.
*
* @private
* @returns {number} degreeToRadian.
*/
readonly _degreeToRadian: number;
/**
* Gets the `PdfLayer` of the annotation.
*
* @returns {PdfLayer} PDF layer to the annotation.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Get the first page of the document
* let page: PdfPage = document.getPage(0);
* // Access the first annotation on the page
* let annotation: PdfAnnotation = page.annotations.at(0);
* // Get the layer of the annotation
* let layer: PdfLayer = annotation.layer;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Set the `PdfLayer` to the annotation.
*
* @param {PdfLayer} value PDF layer to the annotation.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Get the first page of the document
* let page: PdfPage = document.getPage(0);
* // Access the collection of layers in the document
* let layers: PdfLayerCollection = document.layers;
* // Add a new layer to the document with the name 'Layer1'
* let layer: PdfLayer = layers.add('Layer1');
* // Access the first annotation on the page
* let annotation: PdfAnnotation = page.annotations.at(0);
* // Assign the layer to the annotation
* annotation.layer = layer;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
layer: PdfLayer;
/**
* Set the boolean flag to create a new appearance stream for annotations.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Set the boolean flag to create a new appearance stream for annotations.
* document.getPage(0).annotations.at(0).setAppearance(true);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*
* @param {boolean} value Set appearance.
* @returns {void} Nothing.
*/
setAppearance(value: boolean): void;
/**
* Gets the values associated with the specified key.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Gets the values associated with the key 'Author'.
* let values: string[] = document.getPage(0).annotations.at(0).getValues('Author');
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*
* @param {string} name Key.
* @returns {string[]} Values associated with the key.
*/
getValues(name: string): string[];
/**
* Sets the values associated with the specified key.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access the annotation at index 0
* let annotation: PdfAnnotation = document.getPage(0).annotations.at(0);
* // Set Unknown state and model
* annotation.setValues('State', 'StateModel');
* annotation.setValues('StateModel', 'CustomState');
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*
* @param {string} name Key.
* @param {string} value Value associated with the key..
* @returns {void} Nothing.
*/
setValues(name: string, value: string): void;
/**
* Exports a single annotation to the specified format (XFDF or JSON).
*
* @private
* @param {DataFormat} format The format to export (DataFormat.xfdf or DataFormat.json).
* @returns {Uint8Array} Exported annotation data as byte array.
*/
_export(format: DataFormat): Uint8Array;
/**
* Exports the annotation as XFDF format.
*
* @private
* @param {PdfDocument} document The PDF document.
* @param {number} pageIndex The page index.
* @returns {Uint8Array} XFDF data as byte array.
*/
_exportAsXfdf(document: PdfDocument, pageIndex: number): Uint8Array;
/**
* Exports the annotation as JSON format.
*
* @private
* @param {PdfDocument} document The PDF document.
* @param {number} pageIndex The page index.
* @returns {Uint8Array} JSON data as byte array.
*/
_exportAsJson(document: PdfDocument, pageIndex: number): Uint8Array;
/**
* Initializes the annotation with its owning page and dictionary,
* assigning cross reference information and setting the page reference
* when loading a new annotation instance.
*
* @private
* @param {PdfPage} page Owning page.
* @param {_PdfDictionary} [dictionary] Annotation dictionary to initialize from.
* @returns {void} nothing.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Retrieves the rotation angle for the annotation from its dictionary,
* preferring `Rotate` over `Rotation`, and skipping polygon/rectangle types.
*
* @private
* @returns {number} angle Rotation angle in degrees.
*/
_getRotationAngle(): number;
/**
* Retrieves the pages media box or crop box array, returning the media box
* when available, otherwise falling back to the crop box definition.
*
* @private
* @param {PdfPage} page Page whose box is requested.
* @returns {number[]} box Array in the form [x, y, width, height].
*/
_getMediaOrCropBox(page: PdfPage): number[];
/**
* Computes the bounding rectangle from a flat array of line coordinates,
* optionally expanding the bounds by the annotations border width padding.
*
* @private
* @param {number[]} linePoints Flat array of points [x1, y1, x2, y2, ...].
* @param {number} [borderWidth] Optional border width to pad the bounds.
* @returns {{x: number, y: number, width: number, height: number}} bounds.
*/
_getBoundsValue(linePoints: number[], borderWidth?: number): {
x: number;
y: number;
width: number;
height: number;
};
/**
* Executes per-annotation post-processing specific to the concrete type,
* optionally applying flattening behavior according to the given flag.
*
* @private
* @param {boolean} [isFlatten] When true, applies flattening logic.
* @returns {void} nothing.
*/
abstract _doPostProcess(isFlatten?: boolean): void;
/**
* Validates the transformation matrix for the annotations appearance stream.
* When no template is provided, checks for identity rotation and flags location
* displacement when applicable.
*
* @private
* @param {_PdfDictionary} dictionary Appearance dictionary.
* @returns {boolean} isValid True if matrix considered valid/identity scenario.
*/
_validateTemplateMatrix(dictionary: _PdfDictionary): boolean;
/**
* Validates the transformation matrix for the annotations appearance stream.
* When a template is provided, draws the template with page graphics if offsets
* require it and removes the annotation; otherwise leaves the annotation as-is.
*
* @private
* @param {_PdfDictionary} dictionary Appearance dictionary.
* @param {PdfTemplate} template Appearance template.
* @returns {boolean} isValid True when the matrix is valid and template kept.
*/
_validateTemplateMatrix(dictionary: _PdfDictionary, template: PdfTemplate): boolean;
/**
* Flattens the annotations appearance template onto the page graphics,
* normalizing bounds with media/crop box adjustments, handling rotation and
* non identity matrices including rubber stamp scaling, applying opacity,
* drawing the template, and removing the annotation from the page.
*
* @private
* @param {PdfTemplate} template Appearance template to draw.
* @param {boolean} isNormalMatrix True if the template uses an identity matrix.
* @param {boolean} [isLineAnnotation=false] True if invoked for a line annotation.
* @returns {void} nothing.
*/
_flattenAnnotationTemplate(template: PdfTemplate, isNormalMatrix: boolean, isLineAnnotation?: boolean): void;
/**
* Computes the templates final drawing bounds on the page by considering the page graphics rotation,
* annotation rotation, and non identity matrices, applying the necessary transforms and size swaps.
*
* @private
* @param {{x: number, y: number, width: number, height: number}} bounds Annotation bounds in page space. // eslint-disable-line
* @param {PdfPage} page Page to draw on.
* @param {PdfTemplate} template Appearance template.
* @param {boolean} isNormalMatrix True when the template uses identity matrix.
* @param {PdfGraphics} graphics Target graphics.
* @returns {{x: number, y: number, width: number, height: number}} computedBounds.
*/
_calculateTemplateBounds(bounds: {
x: number;
y: number;
width: number;
height: number;
}, page: PdfPage, template: PdfTemplate, isNormalMatrix: boolean, graphics: PdfGraphics): {
x: number;
y: number;
width: number;
height: number;
};
/**
* Derives the graphics rotation angle in degrees from the transformation matrix and normalizes it to standard orientations.
*
* @private
* @param {_PdfTransformationMatrix} matrix Graphics transformation matrix.
* @returns {number} angle Rotation angle in degrees (0, 90, 180, 270).
*/
_obtainGraphicsRotation(matrix: _PdfTransformationMatrix): number;
/**
* Removes the specified annotation from the given page and marks the page dictionary as updated.
*
* @private
* @param {PdfPage} page Page from which to remove the annotation.
* @param {PdfAnnotation} annotation Annotation to remove.
* @returns {void} nothing.
*/
_removeAnnotation(page: PdfPage, annotation: PdfAnnotation): void;
/**
* Draws a cloud-style path along the given polyline by laying out overlapping circular arcs (using radius/overlap),
* resolving arc angles, building the path in appearance or page space, and rendering it with the provided brush/pen.
*
* @private
* @param {PdfGraphics} graphics Target graphics.
* @param {PdfBrush} brush Fill brush (optional).
* @param {PdfPen} pen Stroke pen.
* @param {number} radius Arc radius.
* @param {number} overlap Overlap factor (0..1).
* @param {Array<Point>} points Polyline points.
* @param {boolean} isAppearance True if drawing in appearance space.
* @returns {void} nothing.
*/
_drawCloudStyle(graphics: PdfGraphics, brush: PdfBrush, pen: PdfPen, radius: number, overlap: number, points: Array<Point>, isAppearance: boolean): void;
/**
* Determines whether the given polygon/polyline points are ordered clockwise using a signed edge-sum test.
*
* @private
* @param {Array<Point>} points Points of polygon/polyline.
* @returns {boolean} isClockwise.
*/
_isClockWise(points: Array<Point>): boolean;
/**
* Computes the pair of intersection angles in degrees between two points
* for a circle of the given radius, returning [startAngle, endAngle].
*
* @private
* @param {number[]} first First point as [x, y].
* @param {number[]} second Second point as [x, y].
* @param {number} radius Circle radius.
* @returns {number[]} degreesPair [startAngle, endAngle] in degrees.
*/
_getIntersectionDegrees(first: number[], second: number[], radius: number): number[];
/**
* Applies border style settings like dash/dash pattern and adjusts the given rectangle based on border width,
* dictionary RD insets, and the provided parameter (paint bounds or cloudy effect), then returns the updated bounds.
*
* @private
* @param {PdfPen} borderPen Border pen (modified when dashes are present).
* @param {number[]} rectangle Rectangle as [x, y, width, height] (updated in place).
* @param {number} borderWidth Half of border width.
* @param {PdfBorderEffect|_PaintParameter} [parameter] Optional border effect or paint parameter.
* @returns {number[]} rect Updated rectangle [x, y, width, height].
*/
_obtainStyle(borderPen: PdfPen, rectangle: number[], borderWidth: number, parameter?: PdfBorderEffect | _PaintParameter): number[];
/**
* Creates the normal appearance template for a rectangle annotation, updating RD/bounds for cloudy effects,
* configuring pens/brushes and opacity, and drawing either a clouded or standard rectangle.
*
* @private
* @param {PdfBorderEffect} borderEffect Border effect (cloudy) definition.
* @returns {PdfTemplate} template Appearance template.
*/
_createRectangleAppearance(borderEffect: PdfBorderEffect): PdfTemplate;
/**
* Renders a rectangle annotation appearance, using a cloudy outline when intensity produces a positive radius,
* otherwise drawing a standard rectangle with the provided pen and brush.
*
* @private
* @param {number[]} rectangle Rectangle [x, y, width, height] in template space.
* @param {PdfGraphics} graphics Target graphics.
* @param {_PaintParameter} parameter Paint parameter containing pen/brush.
* @param {number} intensity Cloudy intensity (affects radius).
* @returns {void} nothing.
*/
_drawRectangleAppearance(rectangle: number[], graphics: PdfGraphics, parameter: _PaintParameter, intensity: number): void;
/**
* Creates the normal appearance template for a circle/ellipse annotation, configuring dash styles and brushes,
* adjusting bounds via border insets, handling opacity and BE effects, and drawing the ellipse.
*
* @private
* @returns {PdfTemplate} template Appearance template.
*/
_createCircleAppearance(): PdfTemplate;
/**
* Draws the circle/ellipse annotation appearance, using a cloudy outline when an RD-derived radius is present;
* otherwise renders a standard ellipse with the given border width, pen, and brush.
*
* @private
* @param {number[]} rectangle Rectangle [x, y, width, height] in template space.
* @param {number} borderWidth Half of border width.
* @param {PdfGraphics} graphics Target graphics.
* @param {_PaintParameter} parameter Paint parameter with pen/brush.
* @returns {void} nothing.
*/
_drawCircleAppearance(rectangle: number[], borderWidth: number, graphics: PdfGraphics, parameter: _PaintParameter): void;
/**
* Generates Bezier points between the given start and end knots using the control point,
* seeding both endpoints and delegating subdivision to the internal routine, and appends them to the output list.
*
* @private
* @param {number[]} first Start point [x, y].
* @param {number[]} second Control point [x, y].
* @param {number[]} third End point [x, y].
* @param {Array<number[]>} bezierPoints Output array to receive points.
* @returns {void} nothing.
*/
_createBezier(first: number[], second: number[], third: number[], bezierPoints: Array<number[]>): void;
/**
* Recursively subdivides a quadratic Bézier segment using midpoints to refine the curve up to the iteration limit,
* appending the computed midpoints to the output list.
*
* @private
* @param {number[]} first Start point [x, y].
* @param {number[]} second Control point [x, y].
* @param {number[]} third End point [x, y].
* @param {number} currentIteration Current iteration count.
* @param {Array<number[]>} bezierPoints Output point array.
* @returns {void} nothing.
*/
_populateBezierPoints(first: number[], second: number[], third: number[], currentIteration: number, bezierPoints: Array<number[]>): void;
/**
* Computes the midpoint between two 2D points represented as [x, y] coordinate arrays.
*
* @private
* @param {number[]} first First point [x, y].
* @param {number[]} second Second point [x, y].
* @returns {number[]} midpoint [x, y].
*/
_midPoint(first: number[], second: number[]): number[];
/**
* Calculates the absolute angle in degrees of a line defined by two points, normalizing to the range 0..360 and handling vertical lines.
*
* @private
* @param {Point[]} linePoints Two points defining a line.
* @returns {number} angle Angle in degrees.
*/
_getAngle(linePoints: Point[]): number;
/**
* Computes a new point by offsetting the given coordinate by the specified angle and optional length using degree-to-radian conversion.
*
* @private
* @param {Point} value Base coordinate.
* @param {number} angle Angle in degrees.
* @param {number} [length] Offset length (defaults to 0).
* @returns {Point} point New coordinate.
*/
_getAxisValue(value: Point, angle: number, length?: number): Point;
/**
* Computes the geometry for an open arrowhead at the lines begin or end.
*
* @private
* @param {boolean} isBegin True for begin, false for end.
* @param {Point} axisPoint Axis point.
* @param {number} angle Angle in degrees.
* @param {number} length Marker length unit.
* @returns {{startPoint: Point, first: Point, second: Point}} points.
*/
_prepareOpenArrow(isBegin: boolean, axisPoint: Point, angle: number, length: number): {
startPoint: Point;
first: Point;
second: Point;
};
/**
* Computes the geometry for a reverse open arrowhead at the lines begin or end.
*
* @private
* @param {boolean} isBegin True for begin, false for end.
* @param {Point} axisPoint Axis point.
* @param {number} angle Angle in degrees.
* @param {number} length Marker length unit.
* @returns {{startPoint: Point, first: Point, second: Point}} points.
*/
_prepareReverseOpenArrow(isBegin: boolean, axisPoint: Point, angle: number, length: number): {
startPoint: Point;
first: Point;
second: Point;
};
/**
* Computes the geometry for a closed arrowhead at the lines begin or end.
*
* @private
* @param {boolean} isBegin True for begin, false for end.
* @param {Point} axisPoint Axis point.
* @param {number} angle Angle in degrees.
* @param {number} length Marker length unit.
* @returns {{startPoint: Point, first: Point, second: Point}} points.
*/
_prepareClosedArrow(isBegin: boolean, axisPoint: Point, angle: number, length: number): {
startPoint: Point;
first: Point;
second: Point;
};
/**
* Computes the geometry for a reverse closed arrowhead at the lines begin or end.
*
* @private
* @param {boolean} isBegin True for begin, false for end.
* @param {Point} axisPoint Axis point.
* @param {number} angle Angle in degrees.
* @param {number} length Marker length unit.
* @returns {{startPoint: Point, first: Point, second: Point}} points.
*/
_prepareReverseCloseArrow(isBegin: boolean, axisPoint: Point, angle: number, length: number): {
startPoint: Point;
first: Point;
second: Point;
};
/**
* Computes the two points of a slash marker relative to the axis point by offsetting at angle ± fixed offsets scaled by the given length.
*
* @private
* @param {Point} axisPoint Axis point.
* @param {number} angle Angle in degrees.
* @param {number} length Marker length unit.
* @returns {{first: Point, second: Point}} points.
*/
_prepareSlash(axisPoint: Point, angle: number, length: number): {
first: Point;
second: Point;
};
/**
* Computes the four vertices of a diamond centered at the axis point by offsetting at 0°, 90°, 180°, scaled by the given length.
*
* @private
* @param {Point} axisPoint Axis point.
* @param {number} length Marker length unit.
* @returns {{first: Point, second: Point, third: Point, fourth: Point}} points.
*/
_prepareDiamond(axisPoint: Point, length: number): {
first: Point;
second: Point;
third: Point;
fourth: Point;
};
/**
* Computes the two points of a butt marker relative to the axis point by offsetting at angle ±90°, scaled by the given length.
*
* @private
* @param {Point} axisPoint Axis point.
* @param {number} angle Angle in degrees.
* @param {number} length Marker length unit.
* @returns {{first: Point, second: Point}} points.
*/
_prepareButt(axisPoint: Point, angle: number, length: number): {
first: Point;
second: Point;
};
/**
* Computes the bounding rectangle for the specified line ending style at the given axis point and angle,
* using the provided pen, length, and begin/end flag.
*
* @private
* @param {Point} axisPoint Axis point.
* @param {number} angle Angle in degrees.
* @param {PdfPen} pen Pen used to draw (for path metrics).
* @param {PdfLineEndingStyle} style Line ending style.
* @param {number} length Marker length unit.
* @param {boolean} isBegin True if begin marker.
* @returns {{x: number, y: number, width: number, height: number}} bounds.
*/
_getBoundsFromLineEndStyle(axisPoint: Point, angle: number, pen: PdfPen, style: PdfLineEndingStyle, length: number, isBegin: boolean): {
x: number;
y: number;
width: number;
height: number;
};
/**
* Draws the specified line ending style at the given axis point and angle using the provided pen and brush,
* honoring the marker length and whether it applies to the begin or end of the line.
*
* @private
* @param {Point} axisPoint Axis point.
* @param {PdfGraphics} graphics Target graphics.
* @param {number} angle Angle in degrees.
* @param {PdfPen} pen Stroke pen.
* @param {PdfBrush} brush Fill brush.
* @param {PdfLineEndingStyle} style Line ending style.
* @param {number} length Marker length unit.
* @param {boolean} isBegin True if begin marker.
* @returns {void} nothing.
*/
_drawLineEndStyle(axisPoint: Point, graphics: PdfGraphics, angle: number, pen: PdfPen, brush: PdfBrush, style: PdfLineEndingStyle, length: number, isBegin: boolean): void;
/**
* Computes the minimal bounding rectangle that encloses both input rectangles and returns the combined bounds.
*
* @private
* @param {{x: number, y: number, width: number, height: number}} rect1 First rectangle.
* @param {{x: number, y: number, width: number, height: number}} rect2 Second rectangle.
* @returns {{x: number, y: number, width: number, height: number}} combinedBounds.
*/
_getCombinedRectangleBounds(rect1: {
x: number;
y: number;
width: number;
height: number;
}, rect2: {
x: number;
y: number;
width: number;
height: number;
}): {
x: number;
y: number;
width: number;
height: number;
};
/**
* Draws the lines begin and end markers using the given angle, pen, brush, and marker length, defaulting the length when zero.
*
* @private
* @param {Point} start Start point of the line.
* @param {Point} end End point of the line.
* @param {PdfGraphics} graphics Target graphics.
* @param {number} angle Line angle in degrees.
* @param {PdfPen} pen Border pen (or null).
* @param {PdfBrush} brush Fill brush.
* @param {PdfAnnotationLineEndingStyle} lineStyle Begin/end line-ending styles.
* @param {number} length Marker length unit.
* @returns {void} nothing.
*/
_drawLineStyle(start: Point, end: Point, graphics: PdfGraphics, angle: number, pen: PdfPen, brush: PdfBrush, lineStyle: PdfAnnotationLineEndingStyle, length: number): void;
/**
* Extracts and returns the annotations font settingsfamily, size, and style—by parsing DS/DA entries or appearance streams,
* normalizing font names and flags, and honoring FreeText font overrides.
*
* @private
* @returns {{ name: string, size: number, style: PdfFontStyle }} fontData.
*/
_obtainFontDetails(): {
name: string;
size: number;
style: PdfFontStyle;
};
/**
* Parses the appearance dictionary using the provided key order to extract font family, size, and style
* from the selected appearance stream.
*
* @private
* @param {_PdfDictionary} source Appearance dictionary (AP).
* @param {string[]} keys Order of keys to check (e.g., N, R, D).
* @returns {{ name: string; fontSize: number; style: PdfFontStyle }} fontData.
*/
_parseFontFromAppearance(source: _PdfDictionary, keys: string[]): {
name: string;
fontSize: number;
style: PdfFontStyle;
};
/**
* Parses font information from an appearance streams resources by reading `Tf` operators,
* resolving the BaseFont name, inferring bold/italic style flags, and extracting the font size.
*
* @private
* @param {any} resourceDict Appearance stream (or reference) containing resources. // eslint-disable-line
* @param {string} fontFamily Placeholder for resolved font family (unused input).
* @param {number} fontSize Placeholder for resolved size (unused input).
* @param {PdfFontStyle} style Placeholder for resolved style (unused input).
* @returns {{ name: string; fontSize: number; style: PdfFontStyle }} fontData.
*/
_obtainAppearanceFont(resourceDict: any, fontFamily: string, fontSize: number, style: PdfFontStyle): {
name: string;
fontSize: number;
style: PdfFontStyle;
};
/**
* Obtains and returns the resolved PdfFont instance by mapping the parsed font name, size, and style
* from the annotations appearance or DS/DA settings.
*
* @private
* @returns {PdfFont} font.
*/
_obtainFont(): PdfFont;
/**
* Maps the given measurement unit to its corresponding graphics unit and canonical unit string e.g., in, cm, mm, p, pt,
* defaulting to inches.
*
* @private
* @param {PdfMeasurementUnit} measurementUnit Input measurement unit.
* @param {string} unitString Output unit string (updated in return object).
* @returns {{graphicsUnit: _PdfGraphicsUnit, unitString: string}} mapping.
*/
_getEqualPdfGraphicsUnit(measurementUnit: PdfMeasurementUnit, unitString: string): {
graphicsUnit: _PdfGraphicsUnit;
unitString: string;
};
/**
* Creates and returns a Measure dictionary configured for the given unit string, initializing distance/area entries,
* formatting fields, and unit conversion factors.
*
* @private
* @param {string} unitString Canonical unit string (in, cm, mm, pt, p).
* @returns {_PdfDictionary} measureDictionary.
*/
_createMeasureDictionary(unitString: string): _PdfDictionary;
/**
* Converts an RGB triplet to a hex color string, defaulting to black when undefined.
*
* @private
* @param {number[]} col RGB array [r, g, b].
* @returns {string} hex Hex color string (#RRGGBB).
*/
_colorToHex(col: number[]): string;
/**
* Converts a single byte component to a two-digit hexadecimal string.
*
* @private
* @param {number} c Component value (0..255).
* @returns {string} hex Two-digit hex.
*/
_componentToHex(c: number): string;
/**
* Computes the axis-aligned bounding box of a rectangle after rotation by the given angle and returns the rotated bounds.
*
* @private
* @param {{ x: number, y: number, width: number, height: number }} bounds Rectangle bounds. // eslint-disable-line
* @param {number} rotateAngle Rotation angle in degrees.
* @returns {{ x: number, y: number, width: number, height: number }} rotatedBounds.
*/
_getRotatedBounds(bounds: {
x: number;
y: number;
width: number;
height: number;
}, rotateAngle: number): {
x: number;
y: number;
width: number;
height: number;
};
/**
* Flattens the current annotations pop-up by drawing a static popup appearance onto the page.
*
* @private
* @returns {void} nothing.
*/
_flattenPopUp(): void;
/**
* Renders and flattens a pop-up annotation onto the specified page using the provided visual settings and content.
*
* @private
* @param {PdfPage} _page Target page.
* @param {PdfColor} color Background color.
* @param {{ x: number, y: number, width: number, height: number }} boundsValue Popup bounds. // eslint-disable-line
* @param {PdfAnnotationBorder} border Popup border.
* @param {string} author Author name.
* @param {string} subject Subject text.
* @param {string} text Content text.
* @returns {void} nothing.
*/
_flattenPop(_page: PdfPage, color: PdfColor, boundsValue: {
x: number;
y: number;
width: number;
height: number;
}, border: PdfAnnotationBorder, author: string, subject: string, text: string): void;
/**
* Flattens a previously loaded pop-up annotation by rendering its stored content and removing the interactive object.
*
* @private
* @returns {void} nothing.
*/
_flattenLoadedPopUp(): void;
/**
* Retrieves and normalizes the rectangle bounds of the pop up from the dictionary, converting coordinates to page space.
*
* @private
* @returns {number[]} rect Normalized array [x, y, width, height].
*/
_getRectangleBoundsValue(): number[];
/**
* Determines a contrasting foreground color (black or white) based on the luminance of the given background color.
*
* @private
* @param {PdfColor} color Background color.
* @returns {PdfColor} foreColor.
*/
_getForeColor(color: PdfColor): PdfColor;
/**
* Draws the author/subject title area of a pop-up and returns the consumed vertical space (tracking height).
*
* @private
* @param {string} author Author text.
* @param {string} subject Subject text.
* @param {number[]} bounds Bounds array [x, y, width, height].
* @param {PdfBrush} backBrush Background brush.
* @param {PdfBrush} aBrush Foreground brush.
* @param {PdfPage} _page Target page.
* @param {number} trackingHeight Current tracking height.
* @param {PdfAnnotationBorder} border Annotation border.
* @returns {number} consumedHeight.
*/
_drawAuthor(author: string, subject: string, bounds: number[], backBrush: PdfBrush, aBrush: PdfBrush, _page: PdfPage, trackingHeight: number, border: PdfAnnotationBorder): number;
/**
* Draws the subject text inside the provided content rectangle on the given page using the bold author font and left middle alignment.
*
* @private
* @param {string} subject Subject text.
* @param {Rectangle} contentRect Content rectangle.
* @param {PdfPage} _page Target page.
* @returns {void} nothing.
*/
_drawSubject(subject: string, contentRect: Rectangle, _page: PdfPage): void;
/**
* Saves the graphics state and applies transparency with the specified blend mode for subsequent drawing operations.
*
* @private
* @param {PdfPage} _page Target page.
* @param {PdfBlendMode} blendMode Blend mode to apply.
* @returns {void} nothing.
*/
_saveGraphics(_page: PdfPage, blendMode: PdfBlendMode): void;
/**
* Formats the given RGB color as a PDF stroke color command string with 3 decimal precision per component.
*
* @private
* @param {PdfColor} color RGB color.
* @returns {string} command PDF color command string.
*/
_getBorderColorString(color: PdfColor): string;
/**
* Converts a JavaScript Date to a PDF date string (D:YYYYMMDDHHmmSSOHH'mm') including the local timezone offset.
*
* @private
* @param {Date} dateTime Input date.
* @returns {string} pdfDate PDF date string.
*/
_dateToString(dateTime: Date): string;
/**
* Parses a PDF or common date string into a JavaScript Date, handling D: format, slashed dates, and timezone offsets.
*
* @private
* @param {string} date Date string.
* @returns {Date} parsedDate.
*/
_stringToDate(date: string): Date;
/**
* Computes the native PDF rectangle array [x, y, right, top] from annotation bounds,
* adjusting for page size and Crop/MediaBox offsets.
*
* @private
* @returns {number[]} rect [x, y, right, top].
*/
_obtainNativeRectangle(): number[];
/**
* Returns a transformed copy of polygon points adjusted by the page CropBox/MediaBox offsets when present.
*
* @private
* @param {Point[]} polygonPoints Points to transform.
* @returns {Point[]} transformedPoints.
*/
_getPoints(polygonPoints: Point[]): Point[];
/**
* Retrieves the page CropBox or MediaBox as a normalized array, correcting negative height cases and defaulting to [0, 0, 0, 0].
*
* @private
* @returns {number[]} box [x, y, width, height] or zeros.
*/
_getCropOrMediaBox(): number[];
private _getDocumentLayer;
private _isMatched;
/**
* Computes and sets the QuadPoints for text selections from stored bounds, accounting for margins, page height, and Crop/MediaBox offsets.
*
* @private
* @param {Size} pageSize represents the page size.
* @returns {void} nothing.
*/
_setQuadPoints(pageSize: Size): void;
/**
* Creates a PdfTemplate for the requested appearance key by reading AP streams, resolving Matrix/BBox,
* normalizing size, and exporting the stream.
*
* @private
* @param {string} [key] Appearance key ('N' by default).
* @returns {PdfTemplate} template or undefined if not found.
*/
_createTemplate(key?: string): PdfTemplate;
/**
* Creates a PdfTemplate for the requested appearance key by reading AP streams, resolving Matrix/BBox,
* normalizing size, and exporting the stream.
*
* @private
* @param {number[]} rect Appearance key .
* @param {number[]} bbox Appearance key .
* @param {number[]} matrix matrix for appearance.
* @returns {number[]} template or undefined if not found.
*/
_getTransformMatrix(rect: number[], bbox: number[], matrix: number[]): number[];
/**
* Returns the axis aligned bounding box [minX, minY, maxX, maxY] of the rectangle r after applying the transform m.
*
* @private
* @param {number[]} r Rectangle [x0, y0, x1, y1].
* @param {number[]} m 2D affine matrix [a, b, c, d, e, f].
* @returns {number[]} aabb [minX, minY, maxX, maxY].
*/
_getAxialAlignedBoundingBox(r: number[], m: number[]): number[];
/**
* Applies the 2D affine transform m to point p and returns the transformed coordinate.
*
* @private
* @param {number[]} p Point [x, y].
* @param {number[]} m Matrix [a, b, c, d, e, f].
* @returns {number[]} pt [x', y'].
*/
_applyTransform(p: number[], m: number[]): number[];
/**
* Transforms the bounding box through the given matrix and returns the resulting [minX, minY, maxX, maxY] extent.
*
* @private
* @param {{ x: number, y: number, width: number, height: number }} bBoxValue Bounds object.
* @param {number[]} matrix Matrix [a, b, c, d, e, f].
* @returns {number[]} rect [minX, minY, maxX, maxY].
*/
_transformBBox(bBoxValue: {
x: number;
y: number;
width: number;
height: number;
}, matrix: number[]): number[];
/**
* Transforms a point (x, y) using the provided 2D affine matrix and returns the resulting coordinate.
*
* @private
* @param {number} x X coordinate.
* @param {number} y Y coordinate.
* @param {number[]} matrix Matrix [a, b, c, d, e, f].
* @returns {number[]} pt [x', y'].
*/
_transformPoint(x: number, y: number, matrix: number[]): number[];
/**
* Returns the minimum numeric value from the given array.
*
* @private
* @param {number[]} values Array of numbers.
* @returns {number} min Minimum value.
*/
_minValue(values: number[]): number;
/**
* Returns the maximum numeric value from the given array.
*
* @private
* @param {number[]} values Array of numbers.
* @returns {number} min Maximum value.
*/
_maxValue(values: number[]): number;
/**
* Imports and registers a template under the specified key, ensuring proper crossreference handling and resource export state.
*
* @private
* @param {PdfTemplate} template Template to register.
* @param {string} key Appearance key.
* @returns {void} nothing.
*/
_drawTemplate(template: PdfTemplate, key: string): void;
/**
* Writes all custom templates into the appearance dictionary, allocating new references and updating the cross reference cache.
*
* @private
* @param {_PdfDictionary} appearance Appearance dictionary (AP).
* @returns {void} nothing.
*/
_drawCustomAppearance(appearance: _PdfDictionary): void;
}
/**
* Represents the annotations which have comments and review history.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0);
* // Access the annotation at index 0
* let annotation: PdfComment = page.annotations.at(0) as PdfComment;
* // Gets the comments of annotation
* let comment: PdfPopupAnnotationCollection = annotation.comments;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
export declare abstract class PdfComment extends PdfAnnotation {
/**
* Gets the comments of the PDF annotation (Read only).
*
* @returns {PdfPopupAnnotationCollection} Annotation comments
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Access first page
* let page: PdfPage = document.getPage(0);
* // Access the annotation at index 0
* let annotation: PdfRectangleAnnotation = page.annotations.at(0) as PdfRectangleAnnotation;
* // Gets the comments of the PDF annotation
* let comments: PdfPopupAnnotationCollection = annotation.comments;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
readonly comments: PdfPopupAnnotationCollection;
/**
* Gets the review history of the PDF annotation (Read only).
*
* @returns {PdfPopupAnnotationCollection} Annotation review history.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Access first page
* let page: PdfPage = document.getPage(0);
* // Access the annotation at index 0
* let annotation: PdfRectangleAnnotation = page.annotations.at(0) as PdfRectangleAnnotation;
* // Gets the comments of the PDF annotation
* let comments: PdfPopupAnnotationCollection = annotation.reviewHistory;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
readonly reviewHistory: PdfPopupAnnotationCollection;
}
/**
* `PdfLineAnnotation` class represents the line annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new line annotation with line points
* const annotation: PdfLineAnnotation = new PdfLineAnnotation({x: 10, y: 50}, {x: 250, y: 50});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfLineAnnotation extends PdfComment {
/**
* Specifies the measurement unit used for line annotations.
*
* @private
*/
_unit: PdfMeasurementUnit;
private _linePoints;
private _leaderExt;
private _leaderLine;
private _leaderOffset;
private _lineIntent;
private _lineEndingStyle;
private _unitString;
private _measure;
/**
* Initializes a new instance of the `PdfLineAnnotation` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfLineAnnotation` class with line points.
*
* @param {Point} startPoint The starting point of the line.
* @param {Point} endPoint The ending point of the line.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new line annotation with line points
* const annotation: PdfLineAnnotation = new PdfLineAnnotation({x: 10, y: 50}, {x: 250, y: 50});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(startPoint: Point, endPoint: Point);
/**
* Initializes a new instance of the `PdfLineAnnotation` class with start/end points and optional properties.
*
* @param {Point} startPoint The starting point of the line.
* @param {Point} endPoint The ending point of the line.
* @param {object} [properties] Optional customization properties.
* @param {string} [properties.text] The content text for the annotation.
* @param {string} [properties.author] Author of the annotation.
* @param {string} [properties.subject] Subject of the annotation.
* @param {PdfColor} [properties.color] Fore color (stroke) of the annotation.
* @param {PdfColor} [properties.innerColor] Fill color for elements (e.g., closed arrow).
* @param {PdfAnnotationLineEndingStyle} [properties.lineEndingStyle] Line ending styles (begin/end).
* @param {number} [properties.opacity] Opacity value from 0 to 1.
* @param {PdfAnnotationBorder} [properties.border] Border settings (width, style, dash).
* @param {PdfMeasurementUnit} [properties.measurementUnit] Unit to apply if Measure is enabled.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create line annotation
* const annot = new PdfLineAnnotation({x: 10, y: 50}, {x: 250, y: 50}, {
* text: 'Dimension',
* author: 'Syncfusion',
* color: {r: 255, g: 0, b: 0},
* lineEndingStyle: new PdfAnnotationLineEndingStyle({begin: PdfLineEndingStyle.openArrow, end: PdfLineEndingStyle.closedArrow}),
* opacity: 0.8,
* border: new PdfAnnotationBorder({width: 2, hRadius: 0, vRadius: 0, style: PdfBorderStyle.dashed, dash: [3, 1]}),
* measurementUnit: PdfMeasurementUnit.centimeter
* });
* // Add annotation to the page
* page.addAnnotation(annot);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(startPoint: Point, endPoint: Point, properties: {
text?: string;
author?: string;
subject?: string;
color?: PdfColor;
innerColor?: PdfColor;
lineEndingStyle?: PdfAnnotationLineEndingStyle;
opacity?: number;
border?: PdfAnnotationBorder;
measurementUnit?: PdfMeasurementUnit;
});
/**
* Gets the line points of the line annotation.
*
* @returns {Point[]} Line points.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the line points of the line annotation.
* let linePoints: Point[] = annotation.linePoints;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the line points of the line annotation.
*
* @param {Point[]} value Line points.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the line points of the line annotation.
* annotation.linePoints = [{x: 10, y: 50}, {x: 250, y: 50}];
* // Destroy the document
* document.destroy();
* ```
*/
linePoints: Point[];
/**
* Gets the line extension of the line annotation.
*
* @returns {number} Leader line extension.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the line extension of the line annotation.
* let leaderExt: number = annotation.leaderExt;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the line extension of the line annotation.
*
* @param {number} value Line extension.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the line extension of the line annotation.
* annotation.leaderExt = 4;
* // Destroy the document
* document.destroy();
* ```
*/
leaderExt: number;
/**
* Gets the leader line of the line annotation.
*
* @returns {number} Leader line.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the leader line of the line annotation.
* let leaderLine: number = annotation.leaderLine;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the leader line of the line annotation.
*
* @param {number} value Leader line.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the leader line of the line annotation.
* annotation.leaderLine = 5;
* // Destroy the document
* document.destroy();
* ```
*/
leaderLine: number;
/**
* Gets the line ending style of the line annotation.
*
* @returns {PdfAnnotationLineEndingStyle} Line ending style.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the line ending style of the line annotation.
* let lineEndingStyle: PdfAnnotationLineEndingStyle = annotation.lineEndingStyle;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the line ending style of the line annotation.
*
* @param {PdfAnnotationLineEndingStyle} value Line ending style.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the line ending style of the line annotation.
* annotation.lineEndingStyle = new PdfAnnotationLineEndingStyle({begin: PdfLineEndingStyle.openArrow, end: PdfLineEndingStyle.closeArrow});
* // Destroy the document
* document.destroy();
* ```
*/
lineEndingStyle: PdfAnnotationLineEndingStyle;
/**
* Gets the leader offset of the line annotation.
*
* @returns {number} Leader offset.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the leader offset value of the line annotation
* let leaderOffset: number = annotation.leaderOffset;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the leader offset of the line annotation.
*
* @param {number} value Leader line offset.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the leader offset of the line annotation.
* annotation.leaderOffset = 1;
* // Destroy the document
* document.destroy();
* ```
*/
leaderOffset: number;
/**
* Gets the line intent of the line annotation.
*
* @returns {PdfLineIntent} Line intent.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the line intent value of the line annotation
* let lineIntent: PdfLineIntent = annotation.lineIntent;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the line intent of the line annotation.
*
* @param {PdfLineIntent} value Line intent.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the line intent of the line annotation.
* annotation.lineIntent = PdfLineIntent.lineDimension;
* // Destroy the document
* document.destroy();
* ```
*/
lineIntent: PdfLineIntent;
/**
* Gets the flag to have measurement dictionary of the line annotation.
*
* @returns {boolean} measure.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the flag to have measurement dictionary of the line annotation.
* let measure: boolean = annotation.measure;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the flag to add measurement dictionary to the line annotation.
*
* @param {boolean} value Measure.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the flag to have measurement dictionary of the line annotation.
* annotation.measure = true;
* // Destroy the document
* document.destroy();
* ```
*/
measure: boolean;
/**
* Gets the measurement unit of the annotation.
*
* @returns {PdfMeasurementUnit} Measurement unit.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the measurement unit of the annotation.
* let unit: PdfMeasurementUnit = annotation.unit;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the measurement unit of the line annotation.
*
* @param {PdfMeasurementUnit} value Measurement unit.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the measurement unit of the annotation.
* annotation.unit = PdfMeasurementUnit.centimeter;
* // Destroy the document
* document.destroy();
* ```
*/
unit: PdfMeasurementUnit;
/**
* Loads a line annotation from the given page and dictionary, marks it as loaded, and initializes internal state.
*
* @private
* @param {PdfPage} page Page containing the annotation.
* @param {_PdfDictionary} dictionary Source annotation dictionary.
* @returns {PdfLineAnnotation} annot Loaded line annotation.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfLineAnnotation;
/**
* Initializes the line annotation for the specified page and optional source dictionary by delegating to the base initializer.
*
* @private
* @param {PdfPage} page Owning page.
* @param {_PdfDictionary} [dictionary] Optional source dictionary.
* @returns {void} nothing.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Finalizes the annotation after creation/load: validates line points, adjusts for Crop/MediaBox offsets, sets defaults, and prepares bounds/appearance.
*
* @private
* @param {boolean} flatten True if invoked during flattening.
* @returns {void} nothing.
*/
_postProcess(flatten: boolean): void;
/**
* Builds or imports the appearance stream depending on state, optionally flattens the annotation (and pop-ups), and updates AP dictionary entries.
*
* @private
* @param {boolean} [isFlatten=false] True if flattening is requested.
* @returns {void} nothing.
*/
_doPostProcess(isFlatten?: boolean): void;
/**
* Creates the measured line appearance template, draws the line, leaders, end styles, and caption with unit conversion, and updates related dictionary entries.
*
* @private
* @param {boolean} _isFlatten True if called during flattening.
* @returns {PdfTemplate} template Appearance template.
*/
_createLineMeasureAppearance(_isFlatten: boolean): PdfTemplate;
/**
* Calculates the signed angle between two points using arctangent and returns the negated result.
*
* @private
* @param {number} startPointX Start X.
* @param {number} startPointY Start Y.
* @param {number} endPointX End X.
* @param {number} endPointY End Y.
* @returns {number} angle Angle in degrees (negated).
*/
_calculateAngle(startPointX: number, startPointY: number, endPointX: number, endPointY: number): number;
/**
* Computes the axis-aligned bounds of a line considering leader offset/extension, end styles, and border width.
*
* @private
* @param {Point[]} linePoints Two line points [{x,y},{x,y}].
* @param {number} leaderLineExt Leader line extension length.
* @param {number} leaderLine Leader line length (can be negative).
* @param {number} leaderOffset Offset distance from the line.
* @param {PdfAnnotationLineEndingStyle} lineStyle Line ending styles (begin/end).
* @param {number} borderWidth Stroke width.
* @returns {{ x: number, y: number, width: number, height: number }} bounds Computed bounds.
*/
_calculateLineBounds(linePoints: Point[], leaderLineExt: number, leaderLine: number, leaderOffset: number, lineStyle: PdfAnnotationLineEndingStyle, borderWidth: number): {
x: number;
y: number;
width: number;
height: number;
};
/**
* Returns characteristic half extents for a given line ending style used to expand bounds in x/y.
*
* @private
* @param {PdfLineEndingStyle} style Line ending style.
* @param {number} borderWidth Stroke width.
* @returns {{x: number, y: number}} extents Half extents in x/y.
*/
_getLinePoint(style: PdfLineEndingStyle, borderWidth: number): {
x: number;
y: number;
};
/**
* Computes the minimal axis aligned bounding rectangle that encloses the given points.
*
* @private
* @param {{x: number, y: number}[]} points Points to enclose.
* @returns {{x: number, y: number, width: number, height: number}} bounds Enclosing rectangle.
*/
_getBounds(points: Array<{
x: number;
y: number;
}>): {
x: number;
y: number;
width: number;
height: number;
};
/**
* Obtains the padded line bounds from current line points and leader/ending settings and returns them as [x, y, width, height].
*
* @private
* @returns {number[]} bounds Array [x, y, width, height].
*/
_obtainLineBounds(): number[];
/**
* Creates or reuses the normal appearance template for a line annotation, drawing the line, leaders, end styles, and optional caption.
*
* @private
* @returns {PdfTemplate} returns normal appearance.
*/
_createAppearance(): PdfTemplate;
/**
* Draws the line either as a single segment or split around the caption gap when inline captions are enabled.
*
* @private
* @param {PdfGraphics} graphics Target graphics.
* @param {PdfPen} pen Stroke pen.
* @param {Point} start Start point (possibly adjusted).
* @param {Point} end End point (possibly adjusted).
* @param {Point} first First split point around caption.
* @param {Point} second Second split point around caption.
* @returns {void} nothing.
*/
_drawLine(graphics: PdfGraphics, pen: PdfPen, start: Point, end: Point, first: Point, second: Point): void;
/**
* Computes the line length converted from points to the configured measurement unit and returns the numeric value.
*
* @private
* @returns {number} length Line length in selected unit.
*/
_convertToUnit(): number;
/**
* Returns a shallow copy of the current line points array.
*
* @private
* @returns {Point[]} points Copy of line points.
*/
_obtainLinePoints(): Point[];
}
/**
* `PdfCircleAnnotation` class represents the circle annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new circle annotation with circle bounds
* const annotation: PdfCircleAnnotation = new PdfCircleAnnotation({x: 10, y: 10, width: 100, height: 100});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfCircleAnnotation extends PdfComment {
/**
* Specifies the measurement unit used for circle annotations.
*
* @private
*/
_unit: PdfMeasurementUnit;
/**
* Determines whether the circle is measured by radius or diameter.
*
* @private
*/
_measureType: PdfCircleMeasurementType;
private _unitString;
private _measure;
/**
* Initializes a new instance of the `PdfCircleAnnotation` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfCircleAnnotation` class.
*
* @param {Rectangle} bounds circle annotation bounds.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new circle annotation with circle bounds
* const annotation: PdfCircleAnnotation = new PdfCircleAnnotation({x: 10, y: 10, width: 100, height: 100});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle);
/**
* Initializes a new instance of the `PdfCircleAnnotation` class with bounds and optional properties.
*
* @param {Rectangle} bounds Circle bounds.
* @param {object} [properties] Optional customization properties.
* @param {string} [properties.text] The content text of the annotation.
* @param {string} [properties.author] Author of the annotation.
* @param {string} [properties.subject] Subject of the annotation.
* @param {PdfColor} [properties.color] Fore color (stroke) of the annotation.
* @param {PdfColor} [properties.innerColor] Fill color of the circle.
* @param {number} [properties.opacity] Opacity value from 0 to 1.
* @param {PdfAnnotationBorder} [properties.border] Border configuration.
* @param {{ unit?: PdfMeasurementUnit, type?: PdfCircleMeasurementType }} [properties.measure] Measurement settings.
*
* ```typescript
* // Load an existing PDF document
* const document = new PdfDocument(data, password);
* // Get the first page
* const page = document.getPage(0);
* // Create circle annotation
* const circle = new PdfCircleAnnotation({ x: 50, y: 100, width: 120, height: 120 }, {
* text: 'Diameter',
* author: 'Syncfusion',
* color: {r: 255, g: 0, b: 0},
* innerColor: {r: 255, g: 255, b: 200},
* opacity: 0.9,
* border: new PdfAnnotationBorder({width: 2, hRadius: 0, vRadius: 0, style: PdfBorderStyle.dashed, dash: [3, 2]}),
* measure: { unit: PdfMeasurementUnit.centimeter, type: PdfCircleMeasurementType.diameter }
* });
* // Add annotation to the page
* page.addAnnotation(circle);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle, properties: {
text?: string;
author?: string;
subject?: string;
color?: PdfColor;
innerColor?: PdfColor;
opacity?: number;
border?: PdfAnnotationBorder;
measure?: {
unit?: PdfMeasurementUnit;
type?: PdfCircleMeasurementType;
};
});
/**
* Gets the flag to have measurement dictionary of the circle annotation.
*
* @returns {boolean} measure.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfCircleAnnotation = page.annotations.at(0) as PdfCircleAnnotation;
* // Gets the flag to have measurement dictionary of the circle annotation.
* let measure: boolean = annotation.measure;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the flag to add measurement dictionary to the annotation.
*
* @param {boolean} value Measure.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfCircleAnnotation = page.annotations.at(0) as PdfCircleAnnotation;
* // Sets the flag to have measurement dictionary of the circle annotation.
* annotation.measure = true;
* // Destroy the document
* document.destroy();
* ```
*/
measure: boolean;
/**
* Gets the measurement unit of the annotation.
*
* @returns {PdfMeasurementUnit} Measurement unit.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfCircleAnnotation = page.annotations.at(0) as PdfCircleAnnotation;
* // Gets the measurement unit of the annotation.
* let unit: PdfMeasurementUnit = annotation.unit;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the measurement unit of the annotation.
*
* @param {PdfMeasurementUnit} value Measurement unit.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfCircleAnnotation = page.annotations.at(0) as PdfCircleAnnotation;
* // Sets the measurement unit of the annotation.
* annotation.unit = PdfMeasurementUnit.centimeter;
* // Destroy the document
* document.destroy();
* ```
*/
unit: PdfMeasurementUnit;
/**
* Gets the measurement type of the annotation.
*
* @returns {PdfCircleMeasurementType} Measurement type.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfCircleAnnotation = page.annotations.at(0) as PdfCircleAnnotation;
* // Gets the measurement type of the annotation.
* let type: PdfCircleMeasurementType = annotation.type;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the measurement type of the annotation.
*
* @param {PdfCircleMeasurementType} value Measurement type.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfCircleAnnotation = page.annotations.at(0) as PdfCircleAnnotation;
* // Sets the measurement type of the annotation.
* annotation.type = PdfCircleMeasurementType.diameter;
* // Destroy the document
* document.destroy();
* ```
*/
measureType: PdfCircleMeasurementType;
/**
* Loads a circle annotation from the given page and dictionary, marks it as loaded, and initializes internal state.
*
* @private
* @param {PdfPage} page Page containing the annotation.
* @param {_PdfDictionary} dictionary Source annotation dictionary.
* @returns {PdfCircleAnnotation} annot Loaded circle annotation.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfCircleAnnotation;
/**
* Initializes the circle annotation for the specified page and optional dictionary by delegating to the base initializer.
*
* @private
* @param {PdfPage} page Owning page.
* @param {_PdfDictionary} [dictionary] Optional source dictionary.
* @returns {void} nothing.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Finalizes the annotation setup: validates bounds, ensures BS/color defaults, updates Rect,
* and builds appearance or measure appearance as needed.
*
* @private
* @param {boolean} isFlatten True if invoked during flattening.
* @returns {void} nothing.
*/
_postProcess(isFlatten: boolean): void;
/**
* Creates or imports the circle s appearance stream based on state, optionally flattens including pop ups,
* and updates AP entries accordingly.
*
* @private
* @param {boolean} [isFlatten=false] True if flattening is requested.
* @returns {void} nothing.
*/
_doPostProcess(isFlatten?: boolean): void;
/**
* Creates the measured circle appearance template, draws the ellipse and diameter/radius indicator
* with a caption, and updates related dictionary entries.
*
* @private
* @param {boolean} _isFlatten True if called during flattening.
* @returns {PdfTemplate} template Appearance template.
*/
_createCircleMeasureAppearance(_isFlatten: boolean): PdfTemplate;
/**
* Converts the circles size from points to the configured measurement unit and returns the numeric value.
*
* @private
* @returns {number} value Radius or diameter in the configured unit.
*/
_convertToUnit(): number;
}
/**
* `PdfEllipseAnnotation` class represents the ellipse annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new ellipse annotation with bounds
* const annotation: PdfEllipseAnnotation = new PdfEllipseAnnotation({x: 10, y: 10, width: 100, height: 100});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfEllipseAnnotation extends PdfComment {
/**
* Initializes a new instance of the `PdfEllipseAnnotation` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfEllipseAnnotation` class with ellipse bounds.
*
* @param {Rectangle} bounds Ellipse annotation bounds.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new ellipse annotation with bounds
* const annotation: PdfEllipseAnnotation = new PdfEllipseAnnotation({x: 10, y: 10, width: 100, height: 100});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle);
/**
* Initializes a new instance of the `PdfEllipseAnnotation` class with bounds and optional properties.
*
* @param {Rectangle} bounds Ellipse bounds.
* @param {object} [properties] Optional customization properties.
* @param {string} [properties.text] The content text of the annotation.
* @param {string} [properties.author] Author of the annotation.
* @param {string} [properties.subject] Subject of the annotation.
* @param {PdfColor} [properties.color] Fore color (stroke).
* @param {PdfColor} [properties.innerColor] Fill color.
* @param {number} [properties.opacity] Opacity 0-1.
* @param {PdfAnnotationBorder} [properties.border] Border configuration.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // create new ellipse annotation
* const ellipse = new PdfEllipseAnnotation({ x: 80, y: 120, width: 160, height: 100 }, {
* text: 'Ellipse', author: 'Syncfusion', subject: 'Ellipse Annotation',
* color: {r: 0, g: 128, b: 255},
* innerColor: {r: 220, g: 240, b: 255},
* opacity: 0.7,
* border: new PdfAnnotationBorder({width: 1, hRadius: 0, vRadius: 0, style: PdfBorderStyle.solid})
* });
* // Add annotation to the page
* page.addAnnotation(ellipse);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle, properties: {
text?: string;
author?: string;
subject?: string;
color?: PdfColor;
innerColor?: PdfColor;
opacity?: number;
border?: PdfAnnotationBorder;
});
/**
* Loads an ellipse annotation from the given page and dictionary, marks it as loaded, and initializes internal state.
*
* @private
* @param {PdfPage} page Page containing the annotation.
* @param {_PdfDictionary} dictionary Source annotation dictionary.
* @returns {PdfEllipseAnnotation} annot Loaded ellipse annotation.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfEllipseAnnotation;
/**
* Initializes the ellipse annotation for the specified page and optional dictionary by delegating to the base initializer.
*
* @private
* @param {PdfPage} page Owning page.
* @param {_PdfDictionary} [dictionary] Optional source dictionary.
* @returns {void} nothing.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Finalizes the annotation setup: validates bounds, ensures BS/color defaults, builds appearance when needed,
* and updates the Rect entry.
*
* @private
* @param {boolean} isFlatten True if invoked during flattening.
* @returns {void} nothing.
*/
_postProcess(isFlatten: boolean): void;
/**
* Creates or imports the ellipses appearance stream based on state, optionally flattens,
* and updates AP entries accordingly.
*
* @private
* @param {boolean} [isFlatten=false] True if flattening is requested.
* @returns {void} nothing.
*/
_doPostProcess(isFlatten?: boolean): void;
}
/**
* `PdfSquareAnnotation` class represents the square annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new square annotation with bounds
* const annotation: PdfSquareAnnotation = new PdfSquareAnnotation({x: 10, y: 10, width: 100, height: 100});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfSquareAnnotation extends PdfComment {
/**
* Specifies the measurement unit used for square annotations.
*
* @private
*/
_unit: PdfMeasurementUnit;
private _unitString;
private _measure;
private _intensity;
/**
* Initializes a new instance of the `PdfSquareAnnotation` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfSquareAnnotation` class with square bounds.
*
* @param {Rectangle} bounds square annotation bounds.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* * // Create a new square annotation with bounds
* const annotation: PdfSquareAnnotation = new PdfSquareAnnotation({x: 10, y: 10, width: 100, height: 100});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle);
/**
* Initializes a new instance of the `PdfSquareAnnotation` class with bounds and optional properties.
*
* @param {Rectangle} bounds Square bounds.
* @param {object} [properties] Optional customization properties.
* @param {string} [properties.text] The content text of the annotation.
* @param {string} [properties.author] Author of the annotation.
* @param {string} [properties.subject] Subject of the annotation.
* @param {PdfColor} [properties.color] Fore color (stroke) of the annotation.
* @param {PdfColor} [properties.innerColor] Fill color of the square.
* @param {number} [properties.opacity] Opacity value from 0 to 1.
* @param {PdfAnnotationBorder} [properties.border] Border configuration.
* @param {PdfMeasurementUnit} [properties.measurementUnit] Measurement unit when measurement is enabled.
*
* ```typescript
* // Load an existing PDF document
* const document = new PdfDocument(data, password);
* // Get the first page
* const page = document.getPage(0);
* // Create square annotation
* const square = new PdfSquareAnnotation({ x: 60, y: 120, width: 120, height: 120 }, {
* text: 'Square',
* author: 'Syncfusion', subject: 'Square Annotation',
* color: { r: 0, g: 128, b: 255 },
* innerColor: { r: 240, g: 240, b: 240 },
* opacity: 0.8,
* border: new PdfAnnotationBorder({width: 2, hRadius: 0, vRadius: 0, style: PdfBorderStyle.dashed, dash: [3, 2]}),
* measurementUnit: PdfMeasurementUnit.inch
* });
* // Add annotation to the page
* page.addAnnotation(square);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle, properties: {
text?: string;
author?: string;
subject?: string;
color?: PdfColor;
innerColor?: PdfColor;
opacity?: number;
border?: PdfAnnotationBorder;
measurementUnit?: PdfMeasurementUnit;
});
/**
* Gets the border effect of the square annotation.
*
* @returns {PdfBorderEffect} Border effect.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfSquareAnnotation = page.annotations.at(0) as PdfSquareAnnotation;
* // Gets the border effect of the square annotation.
* let borderEffect: PdfBorderEffect = annotation.borderEffect;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the border effect of the square annotation.
*
* @param {PdfBorderEffect} value Border effect.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfSquareAnnotation = page.annotations.at(0) as PdfSquareAnnotation;
* // Sets the border effect of the square annotation.
* annotation.borderEffect.intensity = 1;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
borderEffect: PdfBorderEffect;
/**
* Gets the flag to have measurement dictionary of the Square annotation.
*
* @returns {boolean} measure.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfSquareAnnotation = page.annotations.at(0) as PdfSquareAnnotation;
* // Gets the flag to have measurement dictionary of the square annotation.
* let measure: boolean = annotation.measure;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the flag to add measurement dictionary to the annotation.
*
* @param {boolean} value Measure.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfSquareAnnotation = page.annotations.at(0) as PdfSquareAnnotation;
* // Sets the flag to have measurement dictionary of the square annotation.
* annotation.measure = true;
* // Destroy the document
* document.destroy();
* ```
*/
measure: boolean;
/**
* Gets the measurement unit of the annotation.
*
* @returns {PdfMeasurementUnit} Measurement unit.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfSquareAnnotation = page.annotations.at(0) as PdfSquareAnnotation;
* // Gets the measurement unit of the annotation.
* let unit: PdfMeasurementUnit = annotation.unit;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the measurement unit of the annotation.
*
* @param {PdfMeasurementUnit} value Measurement unit.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfSquareAnnotation = page.annotations.at(0) as PdfSquareAnnotation;
* // Sets the measurement unit of the annotation.
* annotation.unit = PdfMeasurementUnit.centimeter;
* // Destroy the document
* document.destroy();
* ```
*/
unit: PdfMeasurementUnit;
/**
* Loads a square annotation from the given page and dictionary, marks it as loaded, and initializes internal state.
*
* @private
* @param {PdfPage} page Page containing the annotation.
* @param {_PdfDictionary} dictionary Source annotation dictionary.
* @returns {PdfSquareAnnotation} annot Loaded square annotation.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfSquareAnnotation;
/**
* Initializes the square/rectangle annotation for the specified page and optional source dictionary by delegating to the base initializer.
*
* @private
* @param {PdfPage} page Owning page.
* @param {_PdfDictionary} [dictionary] Optional source dictionary.
* @returns {void} nothing.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Finalizes the annotation setup: validates bounds, ensures BS/color defaults, optionally creates appearance or measure appearance,
* updates Rect, and writes BE for cloudy borders.
*
* @private
* @param {boolean} isFlatten True if invoked during flattening.
* @returns {void} nothing.
*/
_postProcess(isFlatten: boolean): void;
/**
* Creates or imports the rectangles appearance stream based on state or flattening needs, handles pop-up flattening, and updates AP entries accordingly.
*
* @private
* @param {boolean} [isFlatten=false] True if flattening is requested.
* @returns {void} nothing.
*/
_doPostProcess(isFlatten?: boolean): void;
/**
* Creates the measured square appearance template, draws the rectangle and caption with area in the configured unit,
* and updates related dictionary entries.
*
* @private
* @param {boolean} _isFlatten True if flattening is requested.
* @returns {PdfTemplate} template Appearance template.
*/
_createSquareMeasureAppearance(_isFlatten: boolean): PdfTemplate;
/**
* Computes the square/rectangle area in the configured measurement unit by converting width/height from points and returning the numeric area.
*
* @private
* @returns {number} area Area in the configured unit.
*/
_calculateAreaOfSquare(): number;
}
/**
* `PdfRectangleAnnotation` class represents the rectangle annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new square annotation with bounds
* const annotation: PdfRectangleAnnotation = new PdfRectangleAnnotation({x: 10, y: 10, width: 200, height: 100});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfRectangleAnnotation extends PdfComment {
private _intensity;
/**
* Initializes a new instance of the `PdfRectangleAnnotation` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfRectangleAnnotation` class with rectangle bounds.
*
* @param {Rectangle} bounds rectangle annotation bounds.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new rectangle annotation with bounds
* const annotation: PdfRectangleAnnotation = new PdfRectangleAnnotation({x: 10, y: 10, width: 200, height: 100});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle);
/**
* Initializes a new instance of the `PdfRectangleAnnotation` class with bounds and optional properties.
*
* @param {Rectangle} bounds Rectangle bounds.
* @param {object} [properties] Optional customization properties.
* @param {string} [properties.text] The content text of the annotation.
* @param {string} [properties.author] Author of the annotation.
* @param {string} [properties.subject] Subject of the annotation.
* @param {PdfColor} [properties.color] Fore color (stroke) of the annotation.
* @param {PdfColor} [properties.innerColor] Fill color of the rectangle.
* @param {number} [properties.opacity] Opacity value from 0 to 1.
* @param {PdfAnnotationBorder} [properties.border] Border configuration.
*
* ```typescript
* // Load an existing PDF document
* const document = new PdfDocument(data, password);
* // Get the first page
* const page = document.getPage(0);
* // Create rectangle annotation
* const rect = new PdfRectangleAnnotation({ x: 50, y: 80, width: 200, height: 100 }, {
* text: 'Rect', author: 'Syncfusion', subject: 'Rectangle Annotation',
* color: { r: 255, g: 0, b: 0 },
* innerColor: { r: 255, g: 240, b: 240 },
* opacity: 0.6,
* border: new PdfAnnotationBorder({width: 1, hRadius: 0, vRadius: 0, style: PdfBorderStyle.solid})
* });
* // Add annotation to the page
* page.addAnnotation(rect);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle, properties: {
text?: string;
author?: string;
subject?: string;
color?: PdfColor;
innerColor?: PdfColor;
opacity?: number;
border?: PdfAnnotationBorder;
});
/**
* Gets the border effect of the rectangle annotation.
*
* @returns {PdfBorderEffect} Border effect.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRectangleAnnotation = page.annotations.at(0) as PdfRectangleAnnotation;
* // Gets the border effect of the rectangle annotation.
* let borderEffect: PdfBorderEffect = annotation.borderEffect;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the border effect of the rectangle annotation.
*
* @param {PdfBorderEffect} value Border effect.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRectangleAnnotation = page.annotations.at(0) as PdfRectangleAnnotation;
* // Sets the border effect of rectangle annotation.
* annotation. borderEffect.style = PdfBorderEffectStyle.cloudy;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
borderEffect: PdfBorderEffect;
/**
* Loads a rectangle annotation from the given page and dictionary, marks it as loaded, and initializes internal state.
*
* @private
* @param {PdfPage} page Page containing the annotation.
* @param {_PdfDictionary} dictionary Source annotation dictionary.
* @returns {PdfRectangleAnnotation} annot Loaded rectangle annotation.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfRectangleAnnotation;
/**
* Initializes the annotation for the specified page and optional source dictionary by delegating to the base initializer.
*
* @private
* @param {PdfPage} page Owning page.
* @param {_PdfDictionary} [dictionary] Optional source dictionary.
* @returns {void} nothing.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Finalizes setup after creation or load: validates bounds, ensures BS/color defaults, updates Rect,
* creates appearance when needed, and writes BE for cloudy borders.
*
* @private
* @param {boolean} isFlatten True if invoked during flattening.
* @returns {void} nothing.
*/
_postProcess(isFlatten: boolean): void;
/**
* Creates or imports the rectangle appearance based on state or flattening, optionally flattens (and pop-ups), and updates AP entries accordingly.
*
* @private
* @param {boolean} [isFlatten=false] True if flattening is requested.
* @returns {void} nothing.
*/
_doPostProcess(isFlatten?: boolean): void;
/**
* Verifies whether the templates Matrix/BBox align with the target bounds; if misaligned,
* draws the template directly and removes the annotation.
*
* @private
* @param {_PdfDictionary} dictionary Appearance stream dictionary.
* @param {any} bounds Target bounds on page.
* @param {PdfTemplate} appearanceTemplate Template to draw if misaligned.
* @returns {boolean} isValidMatrix True if matrix is valid; false if drawn & removed.
*/
_isValidTemplateMatrix(dictionary: _PdfDictionary, bounds: {
x: number;
y: number;
width: number;
height: number;
}, appearanceTemplate: PdfTemplate): boolean;
}
/**
* `PdfPolygonAnnotation` class represents the polygon annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new polygon annotation with bounds
* const annotation: PdfPolygonAnnotation = new PdfPolygonAnnotation([{x: 100, y: 300}, {x: 150, y: 200}, {x: 300, y: 200}, {x: 350, y: 300}, {x: 300, y: 400}, {x: 150, y: 400}]);
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfPolygonAnnotation extends PdfComment {
private _lineExtension;
private _intensity;
/**
* Initializes a new instance of the `PdfPolygonAnnotation` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfPolygonAnnotation` class.
*
* @param {Point[]} points Line points.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new polygon annotation with bounds
* const annotation: PdfPolygonAnnotation = new PdfPolygonAnnotation([{x: 100, y: 300}, {x: 150, y: 200}, {x: 300, y: 200}, {x: 350, y: 300}, {x: 300, y: 400}, {x: 150, y: 400}]);
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(points: Point[]);
/**
* Initializes a new instance of the `PdfPolygonAnnotation` class with points and optional properties.
*
* @param {Point[]} points Polygon vertices as Point array.
* @param {object} [properties] Optional customization properties.
* @param {string} [properties.text] The content text of the annotation.
* @param {string} [properties.author] Author of the annotation.
* @param {string} [properties.subject] Subject of the annotation.
* @param {PdfColor} [properties.color] Fore color (stroke).
* @param {PdfColor} [properties.innerColor] Fill color.
* @param {number} [properties.opacity] Opacity 0–1.
* @param {PdfAnnotationBorder} [properties.border] Border configuration.
*
* ```typescript
* // Load an existing PDF document
* const document = new PdfDocument(data, password);
* // Get the first page
* const page = document.getPage(0);
* // Create polygon annotation
* const polygon = new PdfPolygonAnnotation(
* [{ x: 100, y: 300 }, { x: 150, y: 200 }, { x: 300, y: 200 }, { x: 350, y: 300 }, { x: 300, y: 400 }, { x: 150, y: 400 }],
* {
* text: 'Polygon', author: 'Syncfusion', subject: 'Polygon Annotation',
* color: { r: 0, g: 128, b: 255 },
* innerColor: { r: 220, g: 240, b: 255 },
* opacity: 0.7,
* border: new PdfAnnotationBorder({width: 2, hRadius: 0, vRadius: 0, style: PdfBorderStyle.solid})
* }
* );
* // Add annotation to the page
* page.addAnnotation(polygon);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(points: Point[], properties: {
text?: string;
author?: string;
subject?: string;
color?: PdfColor;
innerColor?: PdfColor;
opacity?: number;
border?: PdfAnnotationBorder;
});
/**
* Gets the border effect of the polygon annotation.
*
* @returns {PdfBorderEffect} Border effect.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfPolygonAnnotation = page.annotations.at(0) as PdfPolygonAnnotation;
* // Gets the border effect of the polygon annotation.
* let borderEffect: PdfBorderEffect = annotation.borderEffect;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the border effect of the polygon annotation.
*
* @param {PdfBorderEffect} value Border effect.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfPolygonAnnotation = page.annotations.at(0) as PdfPolygonAnnotation;
* // Sets the border effect of the polygon annotation
* annotation.borderEffect = new PdfBorderEffect(style: PdfBorderEffectStyle.cloudy);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
borderEffect: PdfBorderEffect;
/**
* Gets the line extension of the polygon annotation.
*
* @returns {number} Line extension.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfPolygonAnnotation = page.annotations.at(0) as PdfPolygonAnnotation;
* // Gets the line extension of the polygon annotation
* let lineExtension: number = annotation.lineExtension;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the line extension of the polygon annotation.
*
* @param {number} value Line extension.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfPolygonAnnotation = page.annotations.at(0) as PdfPolygonAnnotation;
* // Sets the line extension of the polygon annotation
* annotation.lineExtension = 5;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
lineExtension: number;
/**
* Loads a polygon annotation from the given page and dictionary, marks it as loaded, and initializes internal state.
*
* @private
* @param {PdfPage} page The page containing the annotation.
* @param {_PdfDictionary} dictionary The source annotation dictionary.
* @returns {PdfPolygonAnnotation} annot The loaded polygon annotation.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfPolygonAnnotation;
/**
* Initializes the polygon annotation for the specified page and optional source dictionary by delegating to the base initializer.
*
* @private
* @param {PdfPage} page The page to associate with this annotation.
* @param {_PdfDictionary} [dictionary] Optional source dictionary to load from.
* @returns {void} void No return value.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Finalizes setup: validates input points, ensures defaults (line extension, color, border), normalizes points with Crop/MediaBox,
* updates Rect/Vertices, and creates appearance when needed.
*
* @private
* @param {boolean} isFlatten Whether the annotation is being flattened.
* @returns {void} void No return value.
*/
_postProcess(isFlatten: boolean): void;
/**
* Builds or imports the polygon appearance depending on state, optionally flattens and normalizes the template matrix,
* and updates AP entries as required.
*
* @private
* @param {boolean} [isFlatten=false] Whether to flatten the annotation.
* @returns {void} void No return value.
*/
_doPostProcess(isFlatten?: boolean): void;
/**
* Creates the polygon appearance template; when flattening, draws directly to the page (optionally with cloudy border),
* otherwise builds a normal appearance with rotation and transparency handling.
*
* @private
* @param {boolean} flatten Whether to build a flattening appearance.
* @returns {PdfTemplate} template The created or imported appearance template.
*/
_createPolygonAppearance(flatten: boolean): PdfTemplate;
/**
* Returns the polygons points transformed into page or appearance space, accounting for page rotation, flattening, and Vertices storage.
*
* @private
* @returns {Point[]} polygonPointArray the transformed polygon points.
*/
_getLinePoints(): Point[];
}
/**
* `PdfPolyLineAnnotation` class represents the polyline annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new poly line annotation with bounds
* const annotation: PdfPolyLineAnnotation = new PdfPolyLineAnnotation ([{x: 100, y: 300}, {x: 180, y: 250}, {x: 300, y: 260}, {x: 360, y: 320}]);
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfPolyLineAnnotation extends PdfComment {
private _lineExtension;
private _beginLine;
private _endLine;
private _pathTypes;
private _polylinePoints;
/**
* Initializes a new instance of the `PdfPolyLineAnnotation` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfPolyLineAnnotation` class.
*
* @param {Point[]} points Line points.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new poly line annotation with bounds
* const annotation: PdfPolyLineAnnotation = new PdfPolyLineAnnotation ([{x: 100, y: 300}, {x: 180, y: 250}, {x: 300, y: 260}, {x: 360, y: 320}]);
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(points: Point[]);
/**
* Initializes a new instance of the `PdfPolyLineAnnotation` class with points and optional properties.
*
* @param {Point[]} points Polyline points as Point array (in order).
* @param {object} [properties] Optional customization properties.
* @param {string} [properties.text] The content text of the annotation.
* @param {string} [properties.author] Author of the annotation.
* @param {string} [properties.subject] Subject of the annotation.
* @param {PdfColor} [properties.color] Fore color (stroke).
* @param {PdfColor} [properties.innerColor] Fill color (for special rendering).
* @param {PdfAnnotationLineEndingStyle} [properties.lineEndingStyle] Ending styles (begin/end).
* @param {number} [properties.opacity] Opacity 0–1.
* @param {PdfAnnotationBorder} [properties.border] Border configuration.
*
* ```typescript
* // Load an existing PDF document
* const document = new PdfDocument(data, password);
* // Get the first page
* const page = document.getPage(0);
* // Create new poly line annotation with bounds
* const polyline = new PdfPolyLineAnnotation(
* [{x: 100, y: 300}, {x: 180, y: 250}, {x: 300, y: 260}, {x: 360, y: 320}],
* {
* text: 'Route', author: 'Syncfusion', subject: 'PolyLine Annotation',
* color: { r: 200, g: 0, b: 0 },
* lineEndingStyle: new PdfAnnotationLineEndingStyle({begin: PdfLineEndingStyle.openArrow, end: PdfLineEndingStyle.closedArrow}),
* opacity: 0.9,
* border: new PdfAnnotationBorder({width: 2, hRadius: 0, vRadius: 0, style: PdfBorderStyle.dashed, dash: [3, 2]})
* }
* );
* // Add annotation to the page
* page.addAnnotation(polyline);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(points: Point[], properties: {
text?: string;
author?: string;
subject?: string;
color?: PdfColor;
innerColor?: PdfColor;
lineEndingStyle?: PdfAnnotationLineEndingStyle;
opacity?: number;
border?: PdfAnnotationBorder;
});
/**
* Gets the begin line ending style of the annotation.
*
* @returns {PdfLineEndingStyle} Begin line ending style.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfPolyLineAnnotation = page.annotations.at(0) as PdfPolyLineAnnotation;
* // Gets the begin line ending style of the annotation.
* let beginLineStyle: PdfLineEndingStyle = annotation.beginLineStyle;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the begin line ending style of the annotation.
*
* @param {PdfLineEndingStyle} value Begin line ending style.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfPolyLineAnnotation = page.annotations.at(0) as PdfPolyLineAnnotation;
* // Sets the begin line ending style of the annotation.
* annotation.beginLineStyle = PdfLineEndingStyle.slash;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
beginLineStyle: PdfLineEndingStyle;
/**
* Gets the end line ending style of the annotation.
*
* @returns {PdfLineEndingStyle} End line ending style.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfPolyLineAnnotation = page.annotations.at(0) as PdfPolyLineAnnotation;
* // Gets the end line ending style of the annotation.
* let endLineStyle: PdfLineEndingStyle = annotation.endLineStyle;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the end line ending style of the annotation.
*
* @param {PdfLineEndingStyle} value End line ending style.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfPolyLineAnnotation = page.annotations.at(0) as PdfPolyLineAnnotation;
* // Sets the end line ending style of the annotation.
* annotation.endLineStyle = PdfLineEndingStyle.square;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
endLineStyle: PdfLineEndingStyle;
/**
* Gets the line extension of the square annotation.
*
* @returns {number} Line extension.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfPolyLineAnnotation = page.annotations.at(0) as PdfPolyLineAnnotation;
* // Gets the line extension of annotation.
* let lineExtension: number = annotation.lineExtension;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the line extension of the square annotation.
*
* @param {number} value Line extension.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfPolyLineAnnotation = page.annotations.at(0) as PdfPolyLineAnnotation;
* // Sets the line extension of the annotation.
* annotation.lineExtension = 3;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
lineExtension: number;
/**
* Loads a polyline annotation from the given page and dictionary, marks it as loaded, and initializes internal state.
*
* @private
* @param {PdfPage} page The page that contains this annotation.
* @param {_PdfDictionary} dictionary The source annotation dictionary to load.
* @returns {PdfPolyLineAnnotation} annot The loaded polyline annotation instance.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfPolyLineAnnotation;
/**
* Initializes the polyline annotation for the specified page and optional source dictionary by delegating to the base initializer.
*
* @private
* @param {PdfPage} page The page to associate with the annotation.
* @param {_PdfDictionary} [dictionary] Optional source dictionary for loading.
* @returns {void} void No return value.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Finalizes setup by validating points, setting defaults for line extension, color, and border,
* computing bounds, updating dictionary entries, and generating appearance when required.
*
* @private
* @param {boolean} isFlatten Whether the annotation is being flattened.
* @returns {void} void No return value.
*/
_postProcess(isFlatten: boolean): void;
/**
* Builds or imports the polyline appearance based on state, handles flattening logic,
* updates AP entries, and draws or replaces templates when needed.
*
* @private
* @param {boolean} [isFlatten=false] Whether to flatten the annotation to page content.
* @returns {void} void No return value.
*/
_doPostProcess(isFlatten?: boolean): void;
/**
* Converts a point from annotation coordinate space into PDF drawing coordinate space by negating the y axis.
*
* @private
* @param {Point} point The point to transform.
* @returns {Point} transformedPoint The transformed point in PDF coordinate space.
*/
_transformToPdfCoordinates(point: Point): Point;
/**
* Expands the provided bounds by the specified border width and returns the updated rectangle.
*
* @private
* @param {{x: number, y: number, width: number, height: number}} boundsValue The original bounds. // eslint-disable-line
* @param {number} borderWidth The border width to expand by.
* @returns {{x: number, y: number, width: number, height: number}} updatedBounds The expanded bounds rectangle.
*/
_updateBorder(boundsValue: {
x: number;
y: number;
width: number;
height: number;
}, borderWidth: number): {
x: number;
y: number;
width: number;
height: number;
};
/**
* Computes the start and end angles of the polyline based on its transformed points and returns angle values
* along with the transformed endpoints.
*
* @private
* @param {PdfPath} path The path representing the polyline.
* @returns {{startAngle: number, endAngle: number, transformedStart: Point, transformedEnd: Point}} result Angles and transformed endpoints.
*/
_prepareStartEndAngle(path: PdfPath): {
startAngle: number;
endAngle: number;
transformedStart: Point;
transformedEnd: Point;
};
/**
* Creates the polyline appearance template, handling flattening, path construction, border and fill rendering,
* and drawing of start/end line styles.
*
* @private
* @param {boolean} flatten Whether to build a flattening appearance.
* @returns {PdfTemplate} template The created or imported appearance template.
*/
_createPolyLineAppearance(flatten: boolean): PdfTemplate;
/**
* Returns the polylines points transformed into page or annotation space, accounting for Vertices usage,
* page rotation, and flattening conditions.
*
* @private
* @returns {Point[]} points The transformed polyline points.
*/
_getLinePoints(): Point[];
}
/**
* `PdfAngleMeasurementAnnotation` class represents the angle measurement annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new angle measurement annotation
* const annotation: PdfAngleMeasurementAnnotation = new PdfAngleMeasurementAnnotation({x: 100, y: 700}, {x: 150, y: 650}, {x: 100, y: 600});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfAngleMeasurementAnnotation extends PdfComment {
/**
* Stores the points used to define the angle for measurement.
*
* @private
*/
_linePoints: number[];
private _measure;
private _firstIntersectionPoint;
private _secondIntersectionPoint;
private _pointArray;
private _startAngle;
private _sweepAngle;
private _radius;
/**
* Initializes a new instance of the `PdfAngleMeasurementAnnotation` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfAngleMeasurementAnnotation` class.
*
* @param {Point} startPoint Starting point.
* @param {Point} midPoint Mid point.
* @param {Point} endPoint End point.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new angle measurement annotation
* const annotation: PdfAngleMeasurementAnnotation = new PdfAngleMeasurementAnnotation({x: 100, y: 700}, {x: 150, y: 650}, {x: 100, y: 600});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(startPoint: Point, midPoint: Point, endPoint: Point);
/**
* Initializes a new instance of the `PdfAngleMeasurementAnnotation` class with points and optional properties.
*
* @param {Point} startPoint First leg end point.
* @param {Point} midPoint Vertex point (angle center).
* @param {Point} endPoint Second leg end point.
* @param {object} [properties] Optional customization properties.
* @param {string} [properties.text] The content text of the annotation.
* @param {string} [properties.author] Author of the annotation.
* @param {string} [properties.subject] Subject of the annotation.
* @param {PdfColor} [properties.color] Fore color (stroke).
* @param {number} [properties.opacity] Opacity 0–1.
* @param {PdfAnnotationBorder} [properties.border] Border configuration.
*
* ```typescript
* // Load an existing PDF document
* const document = new PdfDocument(data, password);
* // Get the first page
* const page = document.getPage(0);
* // Create new angle measurement annotation
* const angle = new PdfAngleMeasurementAnnotation({x: 100, y: 700}, {x: 150, y: 650}, {x: 100, y: 600},
* {text: 'Angle', author: 'Syncfusion', subject: 'Angle Measurement Annotation',
* color: {r: 0, g: 0, b: 0},
* opacity: 0.85,
* border: new PdfAnnotationBorder({width: 1, hRadius: 0, vRadius: 0, style: PdfBorderStyle.solid})}
* );
* // Add annotation to the page
* page.addAnnotation(angle);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(startPoint: Point, midPoint: Point, endPoint: Point, properties: {
text?: string;
author?: string;
subject?: string;
color?: PdfColor;
opacity?: number;
border?: PdfAnnotationBorder;
});
/**
* Gets the flag to have measurement dictionary of the angle measurement annotation.
*
* @returns {boolean} measure.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfAngleMeasurementAnnotation = page.annotations.at(0) as PdfAngleMeasurementAnnotation;
* // Gets the flag to have measurement dictionary of the angle annotation.
* let measure: boolean = annotation.measure;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the flag to add measurement dictionary to the annotation.
*
* @param {boolean} value Measure.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfAngleMeasurementAnnotation = page.annotations.at(0) as PdfAngleMeasurementAnnotation;
* // Sets the flag to add measurement dictionary to the annotation.
* annotation.measure = true;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
measure: boolean;
/**
* Loads an angle measurement annotation from the given page and dictionary, marks it as loaded, and initializes internal state.
*
* @private
* @param {PdfPage} page The page that contains the annotation.
* @param {_PdfDictionary} dictionary The source annotation dictionary to load.
* @returns {PdfAngleMeasurementAnnotation} annot The loaded angle measurement annotation instance.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfAngleMeasurementAnnotation;
/**
* Initializes the angle measurement annotation for the specified page and optional source dictionary by delegating to the base initializer.
*
* @private
* @param {PdfPage} page The page to associate with the annotation.
* @param {_PdfDictionary} [dictionary] Optional source dictionary for loading.
* @returns {void} void No return value.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Finalizes setup by validating points, ensuring BS/color defaults, setting a fallback border width, and generating the angle measurement appearance.
*
* @private
* @returns {void} void No return value.
*/
_postProcess(): void;
/**
* Builds or imports the angle measurement appearance based on state and flattening, updates AP entries, or flattens the template when required.
*
* @private
* @param {boolean} [isFlatten=false] Whether to flatten the annotation to page content.
* @returns {void} void No return value.
*/
_doPostProcess(isFlatten?: boolean): void;
/**
* Creates the angle measurement appearance template, computes the angle/caption, writes measurement metadata, draws the polyline and arc, and updates AP/Rect entries.
*
* @private
* @returns {PdfTemplate} template The created or imported appearance template.
*/
_createAngleMeasureAppearance(): PdfTemplate;
/**
* Calculates and returns the axis-aligned bounds of the angle polyline after Y-axis normalization.
*
* @private
* @returns {number[]} bounds The [x, y, width, height] bounds array.
*/
_getAngleBoundsValue(): number[];
/**
* Returns the three angle-defining points as [x, y] arrays with PDF coordinate Y inversion applied.
*
* @private
* @returns {Array<number[]>} collection The three points as [x, y] arrays.
*/
_obtainLinePoints(): Array<number[]>;
/**
* Computes the interior angle at the vertex, determines arc start/sweep angles using line circle intersections, and returns the signed angle in radians.
*
* @private
* @returns {number} angle The signed interior angle in radians.
*/
_calculateAngle(): number;
/**
* Finds the intersection points between a line segment and a circle centered at centerX, centerY with the given radius and returns both intersections.
*
* @private
* @param {number} centerX X-coordinate of the circle center.
* @param {number} centerY Y-coordinate of the circle center.
* @param {number} radius Circle radius.
* @param {number[]} point1 First point of the segment [x, y].
* @param {number[]} point2 Second point of the segment [x, y].
* @param {number[]} intersection1 Output first intersection [x, y].
* @param {number[]} intersection2 Output second intersection [x, y].
* @returns {{first: number[], second: number[]}} result The pair of intersections {first, second}.
*/
_findLineCircleIntersectionPoints(centerX: number, centerY: number, radius: number, point1: number[], point2: number[], intersection1: number[], intersection2: number[]): {
first: number[];
second: number[];
};
}
/**
* `PdfInkAnnotation` class represents the ink annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new ink annotation with the bounds and ink points
* const annotation: PdfInkAnnotation = new PdfInkAnnotation({x: 0, y: 0, width: 300, height: 400}, [{x: 40, y: 300}, {x: 60, y: 100}, {x: 40, y: 50}, {x: 40, y: 300}]);
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfInkAnnotation extends PdfComment {
private _linePoints;
private _inkPointsCollection;
private _previousCollection;
private _isFlatten;
/**
* Indicates whether the ink annotation has been modified.
*
* @private
*/
_isModified: boolean;
/**
* Enables or disables interactive control points for editing.
*
* @private
*/
_isEnableControlPoints: boolean;
/**
* Initializes a new instance of the `PdfInkAnnotation` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfInkAnnotation` class.
*
* @param {Rectangle} bounds Ink points.
* @param {Point[]} points Line points.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new ink annotation with the bounds and ink points
* const annotation: PdfInkAnnotation = new PdfInkAnnotation({x: 0, y: 0, width: 300, height: 400}, [{x: 40, y: 300}, {x: 60, y: 100}, {x: 40, y: 50}, {x: 40, y: 300}]);
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle, points: Point[]);
/**
* Initializes a new instance of the `PdfInkAnnotation` class with bounds, ink points and optional properties.
*
* @param {Rectangle} bounds Ink annotation bounds.
* @param {Point[]} points Optional initial polyline points (first stroke).
* @param {object} [properties] Optional customization properties.
* @param {string} [properties.text] The content text of the annotation.
* @param {string} [properties.author] Author of the annotation.
* @param {string} [properties.subject] Subject of the annotation.
* @param {PdfColor} [properties.color] Stroke color.
* @param {number} [properties.thickness] Stroke thickness (points).
* @param {number} [properties.opacity] Opacity 0–1.
* @param {Array<Point[]>} [properties.pointsCollection] Multiple stroke paths (each array = one stroke).
*
* ```typescript
* // Load an existing PDF document
* const document = new PdfDocument(data, password);
* // Get the first page
* const page = document.getPage(0);
* // Create new ink annotation
* const ink = new PdfInkAnnotation(
* { x: 50, y: 100, width: 200, height: 150 },
* [{ x: 60, y: 120 }, { x: 120, y: 180 }, { x: 200, y: 160 }],
* {
* text: 'Ink', author: 'Syncfusion',
* subject: 'Ink Annotation',
* color: { r: 0, g: 0, b: 255 },
* thickness: 2,
* opacity: 0.8,
* pointsCollection: [
* [{ x: 60, y: 120 }, { x: 90, y: 130 }, { x: 110, y: 140 }],
* [{ x: 120, y: 180 }, { x: 150, y: 175 }]
* ]
* }
* );
* // Add annotation to the page
* page.addAnnotation(ink);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle, points: Point[], properties: {
text?: string;
author?: string;
subject?: string;
color?: PdfColor;
thickness: number;
opacity?: number;
pointsCollection: Array<Point[]>;
});
/**
* Gets the ink points collection of the annotation.
*
* @returns {Array<Point[]>} Ink points collection.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfInkAnnotation = page.annotations.at(0) as PdfInkAnnotation;
* // Get the ink points collection of the annotation
* let inkPointsCollection: Array<Point[]> = annotation.inkPointsCollection;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the ink points collection of the annotation.
*
* @param {Array<Point[]>} value Ink points collection.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* // Create a new ink annotation
* const annotation: PdfInkAnnotation = new PdfInkAnnotation([0, 0, 300, 400], [{x: 40, y: 300}, {x: 60, y: 100}, {x: 40, y: 50}, {x: 40, y: 300}]);
* // Set the ink points collection of the annotation
* annotation.inkPointsCollection = [[{x: 422, y: 690}, {x: 412, y: 708}, {x: 408, y: 715}, {x: 403, y: 720}, {x: 400, y: 725}], [{x: 420, y: 725}, {x: 420, y: 715}, {x: 415, y: 705}, {x: 400, y: 690}, {x: 405, y: 695}]];
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
inkPointsCollection: Array<Point[]>;
/**
* Loads an ink annotation from the given page and dictionary, marks it as loaded, and initializes internal state.
*
* @private
* @param {PdfPage} page The page that contains the annotation.
* @param {_PdfDictionary} dictionary The source annotation dictionary to load.
* @returns {PdfInkAnnotation} annot The loaded ink annotation instance.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfInkAnnotation;
/**
* Initializes the ink annotation for the specified page and optional source dictionary by delegating to the base initializer.
*
* @private
* @param {PdfPage} page The page to associate with the annotation.
* @param {_PdfDictionary} [dictionary] Optional source dictionary for loading.
* @returns {void} void No return value.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Finalizes setup by validating points, ensuring BS/color defaults, computing bounds from ink data, updating Rect, and creating or attaching the appearance stream.
*
* @private
* @returns {void} void No return value.
*/
_postProcess(): void;
/**
* Builds or imports the ink appearance based on state and flattening, updates AP entries, adjusts Rect, and optionally flattens the annotation and its popup.
*
* @private
* @param {boolean} [isFlatten=false] Whether to flatten the annotation into page content.
* @returns {void} void No return value.
*/
_doPostProcess(isFlatten?: boolean): void;
/**
* Renders the ink strokes into the provided template, handling dots/lines/bezier paths, opacity, and pen settings (e.g., round caps when loaded).
*
* @private
* @param {PdfTemplate} template The template into which the ink appearance is drawn.
* @returns {PdfTemplate} template The same template after drawing content.
*/
_createInkAppearance(template: PdfTemplate): PdfTemplate;
/**
* Computes cubic Bézier control points for a sequence of knots to produce a smooth ink spline, returning paired control point arrays.
*
* @private
* @param {number[][]} point The knot points as [x,y] pairs.
* @param {number[][]} p1 Output array for the first control points.
* @param {number[][]} p2 Output array for the second control points.
* @returns {{ controlP1: Array<number[]>, controlP2: Array<number[]> }} result The paired control points.
*/
_getControlPoints(point: number[][], p1: number[][], p2: number[][]): {
controlP1: Array<number[]>;
controlP2: Array<number[]>;
};
/**
* Solves a tridiagonal system to compute a single set of control point components from the right-hand side vector.
*
* @private
* @param {number[]} rightVector The right-hand side vector.
* @returns {number[]} vector The computed control point components.
*/
_getSingleControlPoint(rightVector: number[]): number[];
/**
* Updates the InkList from current ink collections (respecting Crop/MediaBox offsets), synchronizes previous/modified state, and returns the resulting bounds.
*
* @private
* @returns {Rectangle} bounds The resulting bounds after updating the InkList.
*/
_addInkPoints(): Rectangle;
/**
* Converts a flat numeric InkList into a collection of Point arrays and stores it in the ink points collection.
*
* @private
* @param {Array<number[]>} inkCollection The InkList numeric collection per stroke.
* @returns {void} void No return value.
*/
_updateInkListCollection(inkCollection: Array<number[]>): void;
/**
* Calculates and returns the bounding rectangle for the current ink strokes, padding for border width when needed and updating the annotation bounds.
*
* @private
* @param {Array<number[]>} [inkCollection] Optional numeric InkList to base bounds on.
* @returns {number[]} bounds The [x, y, width, height] bounds of the ink.
*/
_getInkBoundsValue(inkCollection?: Array<number[]>): number[];
private _calculateInkBounds;
/**
* Retrieves the InkList from the annotation dictionary and flattens each strokes coordinate pairs into number arrays, preserving perstroke grouping.
*
* @private
* @returns {Array<number[]>} path The InkList as flat number arrays per stroke.
*/
_obtainInkListCollection(): Array<number[]>;
}
/**
* `PdfPopupAnnotation` class represents the popup annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new popup annotation
* const annotation: PdfPopupAnnotation = new PdfPopupAnnotation('Test popup annotation', {x: 10, y: 40, width: 30, height: 30});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfPopupAnnotation extends PdfComment {
/**
* Specifies the icon used to represent the popup annotation.
*
* @private
*/
_icon: PdfPopupIcon;
private _iconString;
/**
* Defines the state model (e.g., review status) of the annotation.
*
* @private
*/
_stateModel: PdfAnnotationStateModel;
/**
* Indicates the current state within the state model.
*
* @private
*/
_state: PdfAnnotationState;
/**
* Specifies whether the popup is initially open.
*
* @private
*/
_open: boolean;
/**
* Reference to the popup annotation object in the cross-reference table.
*
* @private
*/
_ref: _PdfReference;
/**
* Indicates whether this popup participates in review workflows.
*
* @private
*/
_isReview: boolean;
/**
* Flags whether this popup is a comment entry.
*
* @private
*/
_isComment: boolean;
/**
* Stores the first half of the vector drawing commands for the comment icon.
*
* @private
*/
_comment: string;
/**
* Stores the second half of the vector drawing commands for the comment icon.
*
* @private
*/
_commentSecondHalf: string;
/**
* Stores the vector drawing commands for the note icon.
*
* @private
*/
_note: string;
/**
* Stores the first half of the vector path for the help icon.
*
* @private
*/
_help: string;
/**
* Stores the second half of the vector path for the help icon.
*
* @private
*/
_helpSecondHalf: string;
/**
* Stores the vector path definition for the insert icon.
*
* @private
*/
_insert: string;
/**
* Stores the first half of the vector path for the key icon.
*
* @private
*/
_key: string;
/**
* Stores the second half of the vector path for the key icon.
*
* @private
*/
_keySecondHalf: string;
/**
* Stores the first half of the vector path for the new paragraph icon.
*
* @private
*/
_newParagraph: string;
/**
* Stores the second half of the vector path for the new paragraph icon.
*
* @private
*/
_newParagraphSecondHalf: string;
/**
* Stores the first half of the vector path for the paragraph icon.
*
* @private
*/
_paragraph: string;
/**
* Stores the second half of the vector path for the paragraph icon.
*
* @private
*/
_paragraphSecondHalf: string;
/**
* Initializes a new instance of the `PdfPopupAnnotation` class.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new line annotation
* let lineAnnotation: PdfLineAnnotation = new PdfLineAnnotation({x: 10, y: 50}, {x: 250, y: 50});
* // Create a new popup annotation
* let popup: PdfPopupAnnotation = new PdfPopupAnnotation();
* // Set the author name
* popup.author = 'Syncfusion';
* // Set the text
* popup.text = 'This is first comment';
* // Add comments to the annotation
* lineAnnotation.comments.add(popup);
* // Add annotation to the page
* page.annotations.add(lineAnnotation);
* // Destroy the document
* document.destroy();
* ```
*/
constructor();
/**
* Initializes a new instance of the `PdfPopupAnnotation` class with optional properties.
*
* @param {object} [properties] Optional customization properties.
* @param {string} [properties.author] Author of the annotation.
* @param {string} [properties.subject] Subject.
* @param {PdfColor} [properties.color] Icon accent color.
* @param {PdfPopupIcon} [properties.icon] Popup icon style.
* @param {boolean} [properties.open] Whether popup is open initially.
* @param {PdfAnnotationState} [properties.state] Review state.
* @param {PdfAnnotationStateModel} [properties.stateModel] Review state model.
*
* ```typescript
* // Load an existing PDF document
* const document = new PdfDocument(data, password);
* // Get the first page
* const page = document.getPage(0);
* // Create new popup annotation
* const popup = new PdfPopupAnnotation(
* {
* author: 'Reviewer',
* subject: 'General',
* color: { r: 255, g: 255, b: 0 },
* icon: PdfPopupIcon.comment,
* open: true,
* state: PdfAnnotationState.accepted,
* stateModel: PdfAnnotationStateModel.review
* }
* );
* // Add annotation to the page
* page.addAnnotation(popup);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(properties: {
author?: string;
subject?: string;
color?: PdfColor;
icon?: PdfPopupIcon;
open?: boolean;
state?: PdfAnnotationState;
stateModel?: PdfAnnotationStateModel;
});
/**
* Initializes a new instance of the `PdfPopupAnnotation` class.
*
* @param {string} text Text
* @param {Rectangle} bounds Popup annotation bounds.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new popup annotation
* const annotation: PdfPopupAnnotation = new PdfPopupAnnotation('Test popup annotation', {x: 10, y: 40, width: 30, height: 30});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(text: string, bounds: Rectangle);
/**
* Initializes a new instance of the `PdfPopupAnnotation` class with bounds, text and optional properties.
*
* @param {string} text Note content text.
* @param {Rectangle} bounds Popup icon bounds.
* @param {object} [properties] Optional customization properties.
* @param {string} [properties.author] Author of the annotation.
* @param {string} [properties.subject] Subject.
* @param {PdfColor} [properties.color] Icon accent color.
* @param {PdfPopupIcon} [properties.icon] Popup icon style.
* @param {boolean} [properties.open] Whether popup is open initially.
* @param {PdfAnnotationState} [properties.state] Review state.
* @param {PdfAnnotationStateModel} [properties.stateModel] Review state model.
*
* ```typescript
* // Load an existing PDF document
* const document = new PdfDocument(data, password);
* // Get the first page
* const page = document.getPage(0);
* // Create new popup annotation
* const popup = new PdfPopupAnnotation(
* { x: 200, y: 300, width: 30, height: 30 },
* 'Review this paragraph',
* {
* author: 'Reviewer',
* subject: 'General',
* color: { r: 255, g: 255, b: 0 },
* icon: PdfPopupIcon.comment,
* open: true,
* state: PdfAnnotationState.accepted,
* stateModel: PdfAnnotationStateModel.review
* }
* );
* // Add annotation to the page
* page.addAnnotation(popup);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(text: string, bounds: Rectangle, properties: {
author?: string;
subject?: string;
color?: PdfColor;
icon?: PdfPopupIcon;
open?: boolean;
state?: PdfAnnotationState;
stateModel?: PdfAnnotationStateModel;
});
/**
* Gets the boolean flag indicating whether annotation has open or not.
*
* @returns {boolean} Caption.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfPopupAnnotation = page.annotations.at(0) as PdfPopupAnnotation;
* // Gets the boolean flag indicating whether annotation has open or not.
* let open: boolean = annotation.open;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the boolean flag indicating whether annotation has open or not.
*
* @param {boolean} value Open.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfPopupAnnotation = page.annotations.at(0) as PdfPopupAnnotation;
* // Sets the boolean flag indicating whether annotation has open or not.
* annotation.open = true;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
open: boolean;
/**
* Gets the icon type of the popup annotation.
*
* @returns {PdfPopupIcon} Annotation icon.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfPopupAnnotation = page.annotations.at(0) as PdfPopupAnnotation;
* // Gets the icon type of the popup annotation.
* let icon: PdfPopupIcon = annotation.icon;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the icon type of the popup annotation.
*
* @param {PdfPopupIcon} value Annotation icon.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfPopupAnnotation = page.annotations.at(0) as PdfPopupAnnotation;
* // Sets the icon type of the popup annotation.
* annotation.icon = PdfPopupIcon.newParagraph;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
icon: PdfPopupIcon;
/**
* Gets the state model of the popup annotation.
*
* @returns {PdfAnnotationStateModel} Annotation State Model.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfPopupAnnotation = page.annotations.at(0) as PdfPopupAnnotation;
* // Gets the state model of the popup annotation.
* let stateModel: PdfAnnotationStateModel = annotation.stateModel;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the state model of the popup annotation.
*
* @param {PdfAnnotationStateModel} value Annotation State Model.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfPopupAnnotation = page.annotations.at(0) as PdfPopupAnnotation;
* // Sets the state model of the popup annotation.
* annotation.stateModel = PdfAnnotationStateModel.marked;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
stateModel: PdfAnnotationStateModel;
/**
* Gets the state of the popup annotation.
*
* @returns {PdfAnnotationState} Annotation State.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfPopupAnnotation = page.annotations.at(0) as PdfPopupAnnotation;
* // Gets the state of the popup annotation.
* let state: PdfAnnotationState = annotation.state;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the state of the popup annotation.
*
* @param {PdfAnnotationState} value Annotation State.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfPopupAnnotation = page.annotations.at(0) as PdfPopupAnnotation;
* // Sets the state of the popup annotation.
* annotation.state = PdfAnnotationState.completed;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
state: PdfAnnotationState;
/**
* Loads a popup annotation from the given page and dictionary, marks it as loaded, initializes state, and sets review/comment flags from IRT.
*
* @private
* @param {PdfPage} page The page that contains the annotation.
* @param {_PdfDictionary} dictionary The source annotation dictionary to load.
* @returns {PdfPopupAnnotation} annot The loaded popup annotation instance.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfPopupAnnotation;
/**
* Initializes the popup annotation for the specified page and optional source dictionary by delegating to the base initializer.
*
* @private
* @param {PdfPage} page The page to associate with the annotation.
* @param {_PdfDictionary} [dictionary] Optional source dictionary for loading.
* @returns {void} void No return value.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Completes setup by validating bounds, ensuring BS default, updating Rect, and creating or attaching the appearance stream when required.
*
* @private
* @returns {void} void No return value.
*/
_postProcess(): void;
/**
* Builds or imports the popup appearance as needed, optionally draws it during flattening, flattens the template, and removes the annotation when done.
*
* @private
* @param {boolean} [isFlatten=false] Whether to flatten the annotation to page content.
* @returns {void} void No return value.
*/
_doPostProcess(isFlatten?: boolean): void;
/**
* Creates the popup appearance template and writes the icon’s drawing commands (with optional color and opacity) based on the selected popup icon.
*
* @private
* @returns {PdfTemplate} template The created appearance template.
*/
_createPopupAppearance(): PdfTemplate;
/**
* Maps the popup icon enum to its canonical name string and returns it.
*
* @private
* @param {PdfPopupIcon} icon The popup icon enum value.
* @returns {string} iconName The canonical icon name.
*/
_obtainIconName(icon: PdfPopupIcon): string;
}
/**
* `PdfFileLinkAnnotation` class represents the link annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new file link annotation
* let annotation: PdfFileLinkAnnotation = new PdfFileLinkAnnotation({x: 10, y: 40, width: 30, height: 30}, "image.png");
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfFileLinkAnnotation extends PdfAnnotation {
/**
* Stores the file link action or path associated with this annotation.
*
* @private
*/
_action: string;
private _fileName;
/**
* Initializes a new instance of the `PdfFileLinkAnnotation` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfFileLinkAnnotation` class.
*
* @param {Rectangle} bounds file link annotation bounds.
* @param {string} fileName fileName
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new file link annotation
* let annotation: PdfFileLinkAnnotation = new PdfFileLinkAnnotation({x: 10, y: 40, width: 30, height: 30}, 'image.png');
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle, fileName: string);
/**
* Initializes a new instance of the `PdfFileLinkAnnotation` class with bounds, target file name and optional properties.
*
* @param {Rectangle} bounds Link bounds.
* @param {string} fileName File to launch.
* @param {object} [properties] Optional customization properties.
* @param {string} [properties.text] Display text/label (content metadata).
* @param {string} [properties.author] Author.
* @param {string} [properties.subject] Subject.
* @param {PdfColor} [properties.color] Link color.
* @param {number} [properties.opacity] Opacity 0–1.
* @param {string} [properties.action] Optional JavaScript to run (Next action).
*
* ```typescript
* // Load an existing PDF document
* const document = new PdfDocument(data, password);
* // Get the first page
* const page = document.getPage(0);
* // Create new file link annotation
* const fileLink = new PdfFileLinkAnnotation(
* { x: 100, y: 150, width: 120, height: 18 },
* 'sample.zip',
* { text: 'Open attachment',
* author: 'Syncfusion',
* subject: 'File Link Annotation',
* color: { r: 0, g: 0, b: 255 },
* action: "app.alert('Launching file');" }
* );
* // Add annotation to the page
* page.addAnnotation(fileLink);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle, fileName: string, properties: {
text?: string;
author?: string;
subject?: string;
color?: PdfColor;
opacity?: number;
action?: string;
});
/**
* Gets the action of the annotation.
*
* @returns {string} Action.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfFileLinkAnnotation = page.annotations.at(0) as PdfFileLinkAnnotation;
* // Gets the action of the annotation.
* let action: string = annotation.action;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the action of the annotation.
*
* @param {string} value Action.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfFileLinkAnnotation = page.annotations.at(0) as PdfFileLinkAnnotation;
* // Sets the action of the annotation.
* annotation.action = "app.alert('Launching file');";
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
action: string;
/**
* Loads a file link annotation from the given page and dictionary, marks it as loaded, and initializes internal state.
*
* @private
* @param {PdfPage} page The page that contains the annotation.
* @param {_PdfDictionary} dictionary The source annotation dictionary to load.
* @returns {PdfFileLinkAnnotation} annot The loaded file link annotation instance.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfFileLinkAnnotation;
/**
* Initializes the file link annotation for the specified page and optional source dictionary by delegating to the base initializer.
*
* @private
* @param {PdfPage} page The page to associate with the annotation.
* @param {_PdfDictionary} [dictionary] Optional source dictionary for loading.
* @returns {void} void No return value.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Finalizes the annotation setup: validates bounds, ensures BS defaults, applies the launch action, and updates the Rect entry.
*
* @private
* @returns {void} void No return value.
*/
_postProcess(): void;
/**
* Builds and assigns the annotations launch action dictionary, removes outdated references, and attaches optional JavaScript or nested actions.
*
* @private
* @returns {void} void No return value.
*/
_addAction(): void;
/**
* Performs post processing after load or flattening, importing or generating appearance streams and flattening or removing the annotation when required.
*
* @private
* @param {boolean} [isFlatten=false] Whether to flatten the annotation to page content.
* @returns {void} void No return value.
*/
_doPostProcess(isFlatten?: boolean): void;
}
/**
* `PdfUriAnnotation` class represents the URI annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new URI annotation
* let annotation: PdfUriAnnotation = new PdfUriAnnotation({x: 100, y: 150, width: 200, height: 100}, 'http://www.google.com');
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfUriAnnotation extends PdfAnnotation {
private _uri;
/**
* Initializes a new instance of the `PdfUriAnnotation` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfUriAnnotation` class.
*
* @param {Rectangle} bounds The boundind rectangle of the annotation.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new URI annotation
* let annotation: PdfUriAnnotation = new PdfUriAnnotation({x: 100, y: 150, width: 200, height: 100});
* // Sets the uri of the annotation
* annotation.uri = 'http://www.google.com';
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle);
/**
* Initializes a new instance of the `PdfUriAnnotation` class.
*
* @param {Rectangle} bounds uri annotation bounds.
* @param {string} uri Uri
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new uri annotation
* let annotation: PdfUriAnnotation = new PdfUriAnnotation({x: 100, y: 150, width: 200, height: 100}, 'http://www.google.com');
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle, uri: string);
/**
* Initializes a new instance of the `PdfUriAnnotation` class with bounds, URI and optional properties.
*
* @param {Rectangle} bounds Link bounds.
* @param {string} uri Target URI.
* @param {object} [properties] Optional customization properties.
* @param {string} [properties.text] Content metadata text.
* @param {string} [properties.author] Author.
* @param {string} [properties.subject] Subject.
* @param {PdfColor} [properties.color] Link color.
* @param {PdfColor} [properties.innerColor] Inner color (not commonly used for URI).
* @param {number} [properties.opacity] Opacity 0–1.
* @param {PdfAnnotationBorder} [properties.border] Border configuration.
*
* ```typescript
* // Load an existing PDF document
* const document = new PdfDocument(data, password);
* // Get the first page
* const page = document.getPage(0);
* // Create new uri annotation
* const uriLink = new PdfUriAnnotation(
* { x: 120, y: 220, width: 140, height: 18 },
* 'https://www.syncfusion.com',
* { text: 'Uri', author: 'Syncfusion', subject: 'Uri Annotation', color: { r: 0, g: 0, b: 255 }, opacity: 1,
* border: new PdfAnnotationBorder({width: 1, hRadius: 0, vRadius: 0, style: PdfBorderStyle.solid})}
* );
* // Add annotation to the page
* page.addAnnotation(uriLink);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle, uri: string, properties: {
text?: string;
author?: string;
subject?: string;
color?: PdfColor;
innerColor?: PdfColor;
opacity?: number;
border?: PdfAnnotationBorder;
});
/**
* Gets the uri of the annotation.
*
* @returns {string} Uri.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfUriAnnotation = page.annotations.at(0) as PdfUriAnnotation;
* // Gets the uri of the annotation.
* let uri: string = annotation.uri;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the uri of the annotation.
*
* @param {string} value Uri.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new URI annotation
* let annotation: PdfUriAnnotation = new PdfUriAnnotation(100, 150, 200, 100);
* // Sets the uri of the annotation
* annotation.uri = 'http://www.google.com';
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
uri: string;
/**
* Loads a URI link annotation from the given page and dictionary, marks it as loaded, and initializes internal state.
*
* @private
* @param {PdfPage} page The page that contains the annotation.
* @param {_PdfDictionary} dictionary The source annotation dictionary to load.
* @returns {PdfUriAnnotation} annot The loaded URI annotation instance.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfUriAnnotation;
/**
* Initializes the URI link annotation for the specified page and optional source dictionary by delegating to the base initializer.
*
* @private
* @param {PdfPage} page The page to associate with the annotation.
* @param {_PdfDictionary} [dictionary] Optional source dictionary for loading.
* @returns {void} void No return value.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Finalizes the annotation setup: validates bounds, ensures BS defaults, applies the URI action, and updates the Rect entry.
*
* @private
* @returns {void} void No return value.
*/
_postProcess(): void;
/**
* Creates and assigns the URI action dictionary (S=URI, URI value) and updates the Border array on the annotation.
*
* @private
* @returns {void} void No return value.
*/
_addAction(): void;
/**
* Performs post-processing after load or during flattening: imports or generates the appearance stream and flattens or removes the annotation as needed.
*
* @private
* @param {boolean} [isFlatten=false] Whether to flatten the annotation to page content.
* @returns {void} void No return value.
*/
_doPostProcess(isFlatten?: boolean): void;
}
/**
* `PdfDocumentLinkAnnotation` class represents the document link annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new document link annotation
* let annotation: PdfDocumentLinkAnnotation = new PdfDocumentLinkAnnotation({x: 100, y: 150, width: 40, height: 60});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfDocumentLinkAnnotation extends PdfAnnotation {
/**
* Holds the destination within the current document to navigate to.
*
* @private
*/
_destination: PdfDestination;
/**
* Initializes a new instance of the `PdfDocumentLinkAnnotation` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfDocumentLinkAnnotation` class.
*
* @param {Rectangle} bounds document link annotation bounds.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new document link annotation
* let annotation: PdfDocumentLinkAnnotation = new PdfDocumentLinkAnnotation({x: 100, y: 150, width: 40, height: 60});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle);
/**
* Initializes a new instance of the `PdfDocumentLinkAnnotation` class with bounds, destination and optional properties.
*
* @param {Rectangle} bounds Link bounds.
* @param {PdfDestination} destination Target destination within the same document.
* @param {object} [properties] Optional customization properties.
* @param {string} [properties.text] Content metadata text.
* @param {string} [properties.author] Author.
* @param {string} [properties.subject] Subject.
* @param {PdfColor} [properties.color] Link color.
* @param {PdfColor} [properties.innerColor] Inner color.
* @param {number} [properties.opacity] Opacity 0–1.
* @param {PdfAnnotationBorder} [properties.border] Border configuration.
*
* ```typescript
* // Load an existing PDF document
* const document = new PdfDocument(data, password);
* // Get the first page
* const page = document.getPage(0);
* // Create new document link annotation
* const docLink = new PdfDocumentLinkAnnotation(
* { x: 80, y: 100, width: 120, height: 18 },
* new PdfDestination({page: document.getPage(0), location: { x: 0, y: 0 }, mode: PdfDestinationMode.fitToPage}),
* { color: { r: 0, g: 128, b: 0 }, opacity: 1,
* border: new PdfAnnotationBorder({width: 1, hRadius: 0, vRadius: 0, style: PdfBorderStyle.solid})}
* );
* // Add annotation to the page
* page.addAnnotation(docLink);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle, destination: PdfDestination, properties: {
text?: string;
author?: string;
subject?: string;
color?: PdfColor;
innerColor?: PdfColor;
opacity?: number;
border?: PdfAnnotationBorder;
});
/**
* Gets the destination of the annotation.
*
* @returns {PdfDestination} Destination.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfDocumentLinkAnnotation = page.annotations.at(0) as PdfDocumentLinkAnnotation;
* // Gets the destination of the annotation.
* let destination: PdfDestination =annotation.destination;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the destination of the annotation.
*
* @param {PdfDestination} value Destination.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access first page
* let page: PdfPage = document.getPage(0);
* // Access the annotation at index 0
* let annotation: PdfDocumentLinkAnnotation = page.annotations.at(0) as PdfDocumentLinkAnnotation;
* // Initializes a new instance of the `PdfDestination` class.
* let destination: PdfDestination = new PdfDestination();
* // Sets the zoom factor.
* destination.zoom = 20;
* // Sets the page where the destination is situated.
* destination.page = page;
* // Sets the mode of the destination.
* destination.mode = PdfDestinationMode.fitToPage;
* // Sets the location of the destination.
* destination.location = {x: 20, y: 20};
* // Sets the bounds of the destination.
* destination.destinationBounds = {x: 20, y: 20, width: 100, height: 50};
* // Sets destination to document link annotation.
* annotation.destination = destination;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
destination: PdfDestination;
/**
* Loads a document link annotation from the given page and dictionary, marks it as loaded, and initializes internal state.
*
* @private
* @param {PdfPage} page The page that contains the annotation.
* @param {_PdfDictionary} dictionary The source annotation dictionary to load.
* @returns {PdfDocumentLinkAnnotation} annot The loaded document-link annotation instance.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfDocumentLinkAnnotation;
/**
* Initializes the document link annotation for the specified page and optional source dictionary by delegating to the base initializer.
*
* @private
* @param {PdfPage} page The page to associate with the annotation.
* @param {_PdfDictionary} [dictionary] Optional source dictionary for loading.
* @returns {void} void No return value.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Finalizes setup by validating bounds, assigning the destination entry if present, and updating the Rect value.
*
* @private
* @returns {void} void No return value.
*/
_postProcess(): void;
/**
* Writes the annotations destination array into the dictionary when a destination is defined.
*
* @private
* @returns {void} void No return value.
*/
_addDocument(): void;
/**
* Completes post processing after load or during flattening, updating Dest when needed and flattening or removing the annotation based on appearance availability.
*
* @private
* @param {boolean} [isFlatten=false] Whether to flatten the annotation to page content.
* @returns {void} void No return value.
*/
_doPostProcess(isFlatten?: boolean): void;
}
/**
* `PdfTextWebLinkAnnotation` class represents the link annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new PDF string format
* const format: PdfStringFormat = new PdfStringFormat(PdfTextAlignment.left, PdfVerticalAlignment.top);
* // Create a new standard font
* const font: PdfStandardFont = new PdfStandardFont(PdfFontFamily.helvetica, 10, PdfFontStyle.regular);
* // Get the text size
* let size: number[] = font.measureString("Syncfusion Site", format, {width: 0, height: 0}, 0, 0);
* // Create a new text web link annotation
* let annot: PdfTextWebLinkAnnotation = new PdfTextWebLinkAnnotation({x: 50, y: 40, width: size.width, height: size.height}, {r: 0, g: 0, b: 0}, {r: 165, g: 42, b: 42}, 1);
* // Add annotation to the page
* page.annotations.add(annotation);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfTextWebLinkAnnotation extends PdfAnnotation {
private _url;
private _font;
private _pen;
private _textWebLink;
private _brush;
private _isActionAdded;
/**
* Initializes a new instance of the `PdfTextWebLinkAnnotation` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfTextWebLinkAnnotation` class.
*
* @param {Rectangle} bounds text web link annotation bounds.
* @param {PdfColor} brushColor Brush color.
* @param {PdfColor} penColor Pen color.
* @param {number} penWidth Pen width.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new PDF string format
* const format: PdfStringFormat = new PdfStringFormat(PdfTextAlignment.left, PdfVerticalAlignment.top);
* // Create a new standard font
* const font: PdfStandardFont = new PdfStandardFont(PdfFontFamily.helvetica, 10, PdfFontStyle.regular);
* // Get the text size
* let size: Size = font.measureString("Syncfusion Site", format, {width: 0, height: 0}, 0, 0);
* // Create a new text web link annotation
* let annot: PdfTextWebLinkAnnotation = new PdfTextWebLinkAnnotation({x: 50, y: 40, width: size.width, height: size.height}, {r: 0, g: 0, b: 0}, {r: 165, g: 42, b: 42}, 1);
* // Add annotation to the page
* page.annotations.add(annotation);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle, brushColor: PdfColor, penColor: PdfColor, penWidth: number);
/**
* Initializes a new instance of the `PdfTextWebLinkAnnotation` class with bounds, brush/pen, text and optional properties.
*
* @param {Rectangle} bounds Text link bounds.
* @param {PdfColor} brushColor Brush color for text.
* @param {PdfColor} penColor Pen color for underlines/border.
* @param {number} penWidth Pen width.
* @param {object} [properties] Optional customization properties.
* @param {string} [properties.text] Content metadata text (same caption or descriptive).
* @param {string} [properties.author] Author.
* @param {string} [properties.subject] Subject.
* @param {PdfColor} [properties.color] Fore color (alternative).
* @param {PdfColor} [properties.innerColor] Inner color.
* @param {number} [properties.opacity] Opacity 0–1.
* @param {PdfAnnotationBorder} [properties.border] Border configuration.
*
* ```typescript
* // Load an existing PDF document
* const document = new PdfDocument(data, password);
* // Get the first page
* const page = document.getPage(0);
* const format = new PdfStringFormat(PdfTextAlignment.left, PdfVerticalAlignment.top);
* const size: Size = font.measureString('Syncfusion Site', format, {width: 0, height: 0}, 0, 0);
* // Create new text web link annotation
* const textLink = new PdfTextWebLinkAnnotation(
* { x: 50, y: 40, width: size.width, height: size.height },
* { r: 0, g: 0, b: 255 },
* { r: 165, g: 42, b: 42 },
* 1,
* {text: 'Syncfusion Site', url: 'http://www.syncfusion.com', font: new PdfStandardFont(PdfFontFamily.helvetica, 10), author: 'Syncfusion', subject: 'Annotation',
* color: {r: 255, g: 0, b: 0}, border: new PdfAnnotationBorder({width: 1, hRadius: 0, vRadius: 0, style: PdfBorderStyle.solid})}
* );
* // Add annotation to the page
* page.addAnnotation(textLink);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle, brushColor: PdfColor, penColor: PdfColor, penWidth: number, properties: {
text?: string;
url?: string;
font?: PdfFont;
author?: string;
subject?: string;
color?: PdfColor;
opacity?: number;
border?: PdfAnnotationBorder;
});
/**
* Gets the font of the annotation.
*
* @returns {PdfFont} font.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfTextWebLinkAnnotation = page.annotations.at(0) as PdfTextWebLinkAnnotation;
* // Gets the font of the annotation.
* let font: PdfFont = annotation.font;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the font of the annotation.
*
* @param {PdfFont} value font.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfTextWebLinkAnnotation = page.annotations.at(0) as PdfTextWebLinkAnnotation;
* // Sets the font of the annotation.
* annotation.font = document.embedFont(PdfFontFamily.helvetica, 10, PdfFontStyle.regular);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
font: PdfFont;
/**
* Gets the url of the annotation.
*
* @returns {string} Url.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfTextWebLinkAnnotation = page.annotations.at(0) as PdfTextWebLinkAnnotation;
* // Gets the URL of the annotation.
* let url: string = annotation.url;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the url of the annotation.
*
* @param {string} value Url.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfTextWebLinkAnnotation = page.annotations.at(0) as PdfTextWebLinkAnnotation;
* // Sets the URL of the annotation.
* annotation.url = 'http://www.syncfusion.com';
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
url: string;
/**
* Loads a text weblink annotation from the given page and dictionary, marks it as loaded, and initializes internal state.
*
* @private
* @param {PdfPage} page The page that contains the annotation.
* @param {_PdfDictionary} dictionary The source annotation dictionary to load.
* @returns {PdfTextWebLinkAnnotation} annot The loaded text web link annotation instance.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfTextWebLinkAnnotation;
/**
* Initializes the text weblink annotation for the specified page and optional source dictionary by delegating to the base initializer.
*
* @private
* @param {PdfPage} page The page to associate with the annotation.
* @param {_PdfDictionary} [dictionary] Optional source dictionary for loading.
* @returns {void} void No return value.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Finalizes setup by validating bounds, adding the URI action once, and updating the annotation rectangle.
*
* @private
* @returns {void} void No return value.
*/
_postProcess(): void;
/**
* Draws the link text on the page using the configured font and colors, creates the URI action dictionary, and disables the visible border.
*
* @private
* @returns {void} void No return value.
*/
_addAction(): void;
/**
* Performs final processing after load or during flattening, importing and flattening the appearance stream when available or removing the annotation if none exists.
*
* @private
* @param {boolean} [isFlatten=false] Whether to flatten the annotation to page content.
* @returns {void} void No return value.
*/
_doPostProcess(isFlatten?: boolean): void;
}
/**
* `PdfAttachmentAnnotation` class represents the attachment annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new attachment annotation
* const annotation: PdfAttachmentAnnotation = new PdfAttachmentAnnotation({x: 300, y: 200, width: 30, height: 30}, 'Nature.jpg', imageData);
* // Add annotation to the page
* page.annotations.add(annotation);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfAttachmentAnnotation extends PdfComment {
/**
* Specifies the icon used to display the file attachment.
*
* @private
*/
_icon: PdfAttachmentIcon;
private _stream;
private _fileName;
private _iconString;
/**
* Initializes a new instance of the `PdfAttachmentAnnotation` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfAttachmentAnnotation` class.
*
* @param {Rectangle} bounds Bounds.
* @param {string} fileName FileName.
* @param {string} data Data as base64 string.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new attachment annotation
* const annotation: PdfAttachmentAnnotation = new PdfAttachmentAnnotation({x: 300, y: 200, width: 30, height: 30}, 'Nature.jpg', 'imageData');
* // Add annotation to the page
* page.annotations.add(annotation);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle, fileName: string, data: string);
/**
* Initializes a new instance of the `PdfAttachmentAnnotation` class.
*
* @param {Rectangle} bounds Bounds.
* @param {string} fileName FileName
* @param {Uint8Array} data Data as byte array
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new attachment annotation
* const annotation: PdfAttachmentAnnotation = new PdfAttachmentAnnotation({x: 300, y: 200, width: 30, height: 30}, 'Nature.jpg', imageData);
* // Add annotation to the page
* page.annotations.add(annotation);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle, fileName: string, data: Uint8Array);
/**
* Initializes a new instance of the `PdfAttachmentAnnotation` class with bounds, file and data, and optional properties.
*
* @param {Rectangle} bounds Annotation bounds.
* @param {string} fileName Attachment file name.
* @param {Uint8Array} data File data (bytes).
* @param {object} [properties] Optional customization properties.
* @param {string} [properties.text] Content text.
* @param {PdfAttachmentIcon} [properties.icon] Attachment icon style.
* @param {string} [properties.author] Author.
* @param {string} [properties.subject] Subject.
* @param {PdfColor} [properties.color] Icon accent color.
* @param {number} [properties.opacity] Opacity 0–1.
* @param {PdfAnnotationBorder} [properties.border] Border configuration.
*
* ```typescript
* // Load an existing PDF document
* const document = new PdfDocument(data, password);
* // Get the first page
* const page = document.getPage(0);
* // Create new attachment annotation
* const attach = new PdfAttachmentAnnotation(
* { x: 300, y: 200, width: 30, height: 30 },
* 'Nature.jpg',
* imageData,
* { text: 'Attachment', icon: PdfAttachmentIcon.pushPin, color: { r: 255, g: 0, b: 0 }, opacity: 1,
* border: new PdfAnnotationBorder({width: 1, hRadius: 0, vRadius: 0, style: PdfBorderStyle.solid})}
* );
* // Add annotation to the page
* page.addAnnotation(attach);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle, fileName: string, data: Uint8Array, properties: {
text?: string;
icon?: PdfAttachmentIcon;
author?: string;
subject?: string;
color?: PdfColor;
opacity?: number;
border?: PdfAnnotationBorder;
});
/**
* Gets the icon type of the attachment annotation.
*
* @returns {PdfAttachmentIcon} Annotation icon.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfAttachmentAnnotation = page.annotations.at(0) as PdfAttachmentAnnotation;
* // Gets the icon type of the attachment annotation.
* let icon: PdfAttachmentIcon = annotation.icon;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the icon type of the attachment annotation.
*
* @param {PdfAttachmentIcon} value Annotation icon.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfAttachmentAnnotation = page.annotations.at(0) as PdfAttachmentAnnotation;
* // Sets the icon type of the attachment annotation.
* annotation.icon = PdfAttachmentIcon.pushPin;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
icon: PdfAttachmentIcon;
/**
* Loads an attachment annotation from the given page and dictionary, marks it as loaded, and initializes internal state.
*
* @private
* @param {PdfPage} page The page that contains the annotation.
* @param {_PdfDictionary} dictionary The source annotation dictionary to load.
* @returns {PdfAttachmentAnnotation} annot The loaded attachment annotation instance.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfAttachmentAnnotation;
/**
* Initializes the attachment annotation for the specified page and optional source dictionary by delegating to the base initializer.
*
* @private
* @param {PdfPage} page The page to associate with the annotation.
* @param {_PdfDictionary} [dictionary] Optional source dictionary for loading.
* @returns {void} void No return value.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Finalizes annotation setup by validating bounds, updating the Rect entry, and creating or updating the embedded file attachment.
*
* @private
* @returns {void} void No return value.
*/
_postProcess(): void;
/**
* Creates or updates the embedded file specification, writes the embedded file stream, assigns references, and updates the FS entry in the dictionary.
*
* @private
* @returns {void} void No return value.
*/
_addAttachment(): void;
/**
* Performs post processing after loading or during flattening by importing or generating the appearance stream and flattening or removing the annotation when needed.
*
* @private
* @param {boolean} [isFlatten=false] Whether to flatten the annotation to page content.
* @returns {void} void No return value.
*/
_doPostProcess(isFlatten?: boolean): void;
/**
* Maps the attachment icon enum value to its corresponding standard icon name string and returns it.
*
* @private
* @param {PdfAttachmentIcon} icon The attachment icon value.
* @returns {string} iconName The canonical icon name.
*/
_obtainIconName(icon: PdfAttachmentIcon): string;
}
/**
* `Pdf3DAnnotation` class represents the 3D annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access first page
* let page: PdfPage = document.getPage(0);
* // Access the annotation at index 0
* let annotation: Pdf3DAnnotation = page.annotations.at(0) as Pdf3DAnnotation;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
export declare class Pdf3DAnnotation extends PdfAnnotation {
/**
* Initializes a new instance of the `Pdf3DAnnotation` class.
*
* @private
*/
constructor();
/**
* Loads a 3D annotation from the given page and dictionary, marks it as loaded, and initializes internal state.
*
* @private
* @param {PdfPage} page The page that contains the annotation.
* @param {_PdfDictionary} dictionary The source annotation dictionary to load.
* @returns {Pdf3DAnnotation} annot The loaded 3D annotation instance.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): Pdf3DAnnotation;
/**
* Initializes the 3D annotation for the specified page and optional source dictionary by delegating to the base initializer.
*
* @private
* @param {PdfPage} page The page to associate with the annotation.
* @param {_PdfDictionary} [dictionary] Optional source dictionary for loading.
* @returns {void} void No return value.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Performs post processing during flattening by importing the appearance stream when available or removing the annotation when none exists.
*
* @private
* @param {boolean} [isFlatten=false] Whether to flatten the annotation to page content.
* @returns {void} void No return value.
*/
_doPostProcess(isFlatten?: boolean): void;
}
/**
* `PdfTextMarkupAnnotation` class represents the text markup annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new text markup annotation
* let annotation: PdfTextMarkupAnnotation = new PdfTextMarkupAnnotation('Text markup', {x: 50, y: 100, width: 100, height: 50});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfTextMarkupAnnotation extends PdfComment {
/**
* Defines the text markup type (highlight, underline, etc.).
*
* @private
*/
_textMarkupType: PdfTextMarkupAnnotationType;
private _textMarkUpColor;
/**
* Initializes a new instance of the `PdfTextMarkupAnnotation` class.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new text markup annotation
* const annotation: PdfTextMarkupAnnotation = new PdfTextMarkupAnnotation();
* // Sets the bounds of the annotation.
* annotation.bounds = {x: 50, y: 100, width: 100, height: 100};
* // Add annotation to the page
* page.annotations.add(annotation);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
constructor();
/**
* Initializes a new instance of the `PdfTextMarkupAnnotation` class.
*
* @param {string} text Text.
* @param {Rectangle} bounds Bounds.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new text markup annotation
* const annotation: PdfTextMarkupAnnotation = new PdfTextMarkupAnnotation('Water Mark', {x: 50, y: 100, width: 100, height: 50});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
constructor(text: string, bounds: Rectangle);
/**
* Initializes a new instance of the `PdfTextMarkupAnnotation` class with bounds and optional properties.
*
* @param {string} [properties.text] Content text.
* @param {Rectangle} bounds A primary bounds region (can be zeroed if using `boundsCollection`).
* @param {object} [properties] Optional customization properties.
* @param {Rectangle[]} [properties.boundsCollection] Multiple text fragments to annotate.
* @param {PdfTextMarkupAnnotationType} [properties.textMarkupType] Markup type (highlight/underline/strikeOut/squiggly).
* @param {string} [properties.author] Author.
* @param {string} [properties.subject] Subject.
* @param {PdfColor} [properties.textMarkUpColor] Markup color (stroke/fill depending on type).
* @param {PdfColor} [properties.innerColor] Inner color (if applicable).
* @param {number} [properties.opacity] Opacity 0–1.
* @param {PdfAnnotationBorder} [properties.border] Border configuration.
*
* ```typescript
* // Load an existing PDF document
* const document = new PdfDocument(data, password);
* // Get the first page
* const page = document.getPage(0);
* // Create new text markup annotation
* const highlight = new PdfTextMarkupAnnotation('Water Mark', {x: 0, y: 0, width: 0, height: 0}, {
* boundsCollection: [{x: 50, y: 200, width: 120, height: 14}, {x: 50, y: 215, width: 90, height: 14}],
* textMarkupType: PdfTextMarkupAnnotationType.underline, author: 'Syncfusion', subject: 'Annotation',
* textMarkUpColor: {r: 0, g: 128, b: 255}, innerColor: {r: 0, g: 0, b: 255}, opacity: 0.5,
* border: new PdfAnnotationBorder({width: 1, hRadius: 0, vRadius: 0, style: PdfBorderStyle.solid})
* });
* // Add annotation to the page
* page.addAnnotation(highlight);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(text: string, bounds: Rectangle, properties: {
boundsCollection?: Rectangle[];
textMarkupType?: PdfTextMarkupAnnotationType;
author?: string;
subject?: string;
textMarkUpColor?: PdfColor;
innerColor?: PdfColor;
opacity?: number;
border?: PdfAnnotationBorder;
});
/**
* Gets the bounds of the text markup annotation.
*
* @returns {Rectangle} Bounds.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfTextMarkupAnnotation = page.annotations.at(0) as PdfTextMarkupAnnotation;
* // Gets the bounds of the annotation.
* let bounds: Rectangle = annotation.bounds;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the bounds of the text markup annotation.
*
* @param {Rectangle} value bounds.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfTextMarkupAnnotation = page.annotations.at(0) as PdfTextMarkupAnnotation;
* // Sets the bounds of the annotation.
* annotation.bounds = {x: 10, y: 10, width: 150, height: 5};
* // Destroy the document
* document.destroy();
* ```
*/
bounds: Rectangle;
/**
* Gets the text markup color of the annotation.
*
* @returns {PdfColor} Text markup color as R, G, B color array in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfTextMarkupAnnotation = page.annotations.at(0) as PdfTextMarkupAnnotation;
* // Gets the textMarkUp Color type of the attachment annotation.
* let textMarkUpColor: PdfColor = annotation.textMarkUpColor;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the text markup color of the annotation.
*
* @param {PdfColor} value R, G, B color values in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfTextMarkupAnnotation = page.annotations.at(0) as PdfTextMarkupAnnotation;
* // Sets the textMarkUp Color type of the attachment annotation.
* annotation.textMarkUpColor = {r: 255, g: 255, b: 255};
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
textMarkUpColor: PdfColor;
/**
* Gets the markup type of the annotation.
*
* @returns {PdfTextMarkupAnnotationType} Markup type.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfTextMarkupAnnotation = page.annotations.at(0) as PdfTextMarkupAnnotation;
* // Gets the markup type of the annotation.
* let textMarkupType: PdfTextMarkupAnnotationType = annotation.textMarkupType;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the markup type of the annotation.
*
* @param {PdfTextMarkupAnnotationType} value Markup type.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfTextMarkupAnnotation = page.annotations.at(0) as PdfTextMarkupAnnotation;
* // Sets the markup type of the annotation.
* annotation.textMarkupType = PdfTextMarkupAnnotationType.squiggly;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
textMarkupType: PdfTextMarkupAnnotationType;
/**
* Gets the markup bounds collection of the annotation.
*
* @returns {Array<Rectangle>} Markup bounds.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfTextMarkupAnnotation = page.annotations.at(0) as PdfTextMarkupAnnotation;
* // Gets the markup bounds collection of the annotation.
* let boundsCollection : Array<Rectangle> = annotation.boundsCollection;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the markup bounds collection of the annotation.
*
* @param {Array<Rectangle>} value Markup bounds.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfTextMarkupAnnotation = page.annotations.at(0) as PdfTextMarkupAnnotation;
* // Sets the markup bounds collection of the annotation.
* annotation.boundsCollection = [{x: 50, y: 50, width: 100, height: 100}, {x: 201, y: 101, width: 61, height: 31}, {x: 101, y: 401, width: 61, height: 31}];
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
boundsCollection: Array<Rectangle>;
/**
* Loads a textmarkup annotation from the given page and dictionary and initializes it as a loaded instance.
*
* @private
* @param {PdfPage} page The page that contains the annotation.
* @param {_PdfDictionary} dictionary The source annotation dictionary.
* @returns {PdfTextMarkupAnnotation} The loaded text markup annotation instance.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfTextMarkupAnnotation;
/**
* Computes the native rectangle adjusted for page size and Crop/MediaBox offsets, including newpage settings.
*
* @private
* @returns {number[]} The native rectangle as [x, y, width, height].
*/
_obtainNativeRectangle(): number[];
/**
* Initializes the text markup annotation for the specified page and optional source dictionary.
*
* @private
* @param {PdfPage} page The page to associate with this annotation.
* @param {_PdfDictionary} [dictionary] Optional source dictionary to import from.
* @returns {void} No return value.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Validates bounds, ensures defaults (BS/color), sets subtype, updates QuadPoints/Rect, and creates/attaches the appearance.
*
* @private
* @returns {void} No return value.
*/
_postProcess(): void;
/**
* Completes post processing by creating/importing the appearance stream as needed and flattening or removing the annotation when requested.
*
* @private
* @param {boolean} [isFlatten=false] When true, flattens the annotation into page content and removes it.
* @returns {void} No return value.
*/
_doPostProcess(isFlatten?: boolean): void;
/**
* Creates the markup appearance template using current QuadPoints/bounds and draws highlight/underline/strikeout/squiggly visuals.
*
* @private
* @returns {PdfTemplate} The generated appearance template.
*/
_createMarkupAppearance(): PdfTemplate;
/**
* Generates a squiggly underline path sized to the given width and height using alternating zigzag points.
*
* @private
* @param {number} width The total width available for the squiggly stroke.
* @param {number} height The height of the squiggly area (influences amplitude/pen width).
* @returns {PdfPath} The constructed squiggly path.
*/
_drawSquiggly(width: number, height: number): PdfPath;
}
/**
* `PdfWatermarkAnnotation` class represents the watermark annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new water mark annotation
* const annotation: PdfWatermarkAnnotation = new PdfWatermarkAnnotation('Water Mark', {x: 50, y: 100, width: 100, height: 50});
* // Set the color of the annotation
* annotation.color = {r: 0, g: 0, b: 0};
* // Add annotation to the page
* page.annotations.add(annotation);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfWatermarkAnnotation extends PdfAnnotation {
/**
* Specifies the rotation angle to apply to the watermark.
*
* @private
*/
_rotateAngle: number;
/**
* Holds the watermark display text.
*
* @private
*/
_watermarkText: string;
/**
* Initializes a new instance of the `PdfWatermarkAnnotation` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfWatermarkAnnotation` class.
*
* @param {string} text Text
* @param {Rectangle} bounds Bounds.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new watermark annotation
* const annotation: PdfWatermarkAnnotation = new PdfWatermarkAnnotation('Water Mark', {x: 50, y: 100, width: 100, height: 50});
* // Set the color of the annotation
* annotation.color = {r: 0, g: 0, b: 0};
* // Add annotation to the page
* page.annotations.add(annotation);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
constructor(text: string, bounds: Rectangle);
/**
* Initializes a new instance of the `PdfWatermarkAnnotation` class with bounds and optional properties.
*
* @param {string} text Text
* @param {Rectangle} bounds Watermark bounds.
* @param {object} [properties] Optional customization properties.
* @param {string} [properties.text] Watermark text content.
* @param {string} [properties.author] Author.
* @param {string} [properties.subject] Subject.
* @param {PdfColor} [properties.color] Text color.
* @param {PdfColor} [properties.innerColor] Inner color.
* @param {number} [properties.opacity] Opacity 0–1.
* @param {PdfAnnotationBorder} [properties.border] Border configuration.
*
* ```typescript
* // Load an existing PDF document
* const document = new PdfDocument(data, password);
* // Get the first page
* const page = document.getPage(0);
* // Create new watermark annotation
* const watermark = new PdfWatermarkAnnotation('WaterMark', {x: 100, y: 300, width: 200, height: 40}, {
* text: 'CONFIDENTIAL',
* color: { r: 255, g: 0, b: 0 }, innerColor: {r: 0, g: 255, b: 255},
* opacity: 0.3, new PdfAnnotationBorder({width: 1, hRadius: 0, vRadius: 0, style: PdfBorderStyle.solid})
* });
* // Add annotation to the page
* page.addAnnotation(watermark);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(text: string, bounds: Rectangle, properties: {
author?: string;
subject?: string;
color?: PdfColor;
innerColor?: PdfColor;
opacity?: number;
border?: PdfAnnotationBorder;
});
/**
* Loads a watermark annotation from the given page and dictionary and initializes it as a loaded instance.
*
* @private
* @param {PdfPage} page The page that contains the annotation.
* @param {_PdfDictionary} dictionary The source annotation dictionary.
* @returns {PdfWatermarkAnnotation} The loaded watermark annotation instance.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfWatermarkAnnotation;
/**
* Initializes the watermark annotation for the specified page and optional source dictionary.
*
* @private
* @param {PdfPage} page The page to associate with this annotation.
* @param {_PdfDictionary} [dictionary] Optional source dictionary to import from.
* @returns {void} No return value.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Finalizes setup: validates bounds, ensures BS/color defaults, creates the watermark appearance, updates Rect, and sets CA opacity if provided.
*
* @private
* @returns {void} No return value.
*/
_postProcess(): void;
private _createWatermarkAppearance;
/**
* Completes watermark post processing by creating/importing the appearance stream and flattening or removing the annotation as requested.
*
* @private
* @param {boolean} [isFlatten=false] When true, flattens the annotation into page content, otherwise updates AP entries.
* @returns {void} No return value.
*/
_doPostProcess(isFlatten?: boolean): void;
}
/**
* `PdfRubberStampAnnotation` class represents the rubber stamp annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new rubber stamp annotation
* const annotation: PdfRubberStampAnnotation = new PdfRubberStampAnnotation ({x: 50, y: 100, width: 100, height: 50});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfRubberStampAnnotation extends PdfComment {
/**
* Specifies the rubber stamp icon to render.
*
* @private
*/
_icon: PdfRubberStampAnnotationIcon;
private _stampWidth;
private _iconString;
private rotateAngle;
/**
* When true, adjusts bounds to account for rotation effects.
*
* @private
*/
_alterRotateBounds: boolean;
/**
* Font used when generating the stamp appearance content.
*
* @private
*/
_stampAppearanceFont: PdfStandardFont;
/**
* Stores the appearance object used for custom rendering.
*
* @private
*/
_appearance: PdfAppearance;
/**
* Initializes a new instance of the `PdfRubberStampAnnotation` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfRubberStampAnnotation` class.
*
* @param {Rectangle} bounds Bounds.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new rubber stamp annotation
* const annotation: PdfRubberStampAnnotation = new PdfRubberStampAnnotation ({x: 50, y: 100, width: 100, height: 50});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle);
/**
* Initializes a new instance of the `PdfRubberStampAnnotation` class with bounds and optional properties.
*
* @param {Rectangle} bounds Stamp bounds.
* @param {object} [properties] Optional customization properties.
* @param {PdfRubberStampAnnotationIcon} [properties.icon] Stamp icon preset (e.g., Approved, Draft).
* @param {string} [properties.text] Optional custom text for appearance (when using custom template).
* @param {string} [properties.author] Author.
* @param {string} [properties.subject] Subject.
* @param {PdfColor} [properties.color] Fore color (stroke).
* @param {PdfColor} [properties.innerColor] Fill color.
* @param {number} [properties.opacity] Opacity 0–1.
* @param {PdfAnnotationBorder} [properties.border] Border configuration.
*
* ```typescript
* // Load an existing PDF document
* const document = new PdfDocument(data, password);
* // Get the first page
* const page = document.getPage(0);
* // Create new rubber stamp annotation
* const stamp = new PdfRubberStampAnnotation({ x: 50, y: 100, width: 100, height: 50 }, {
* icon: PdfRubberStampAnnotationIcon.approved, text: 'Rubber stamp', author: 'Syncfusion', subject: 'Annnot',
* opacity: 0.9, new PdfAnnotationBorder({width: 1, hRadius: 0, vRadius: 0, style: PdfBorderStyle.solid})
* });
* // Add annotation to the page
* page.addAnnotation(stamp);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle, properties: {
icon?: PdfRubberStampAnnotationIcon;
text?: string;
author?: string;
subject?: string;
color?: PdfColor;
innerColor?: PdfColor;
opacity?: number;
border?: PdfAnnotationBorder;
});
/**
* Gets the icon type of the rubber stamp annotation.
*
* @returns {PdfRubberStampAnnotationIcon} Annotation icon.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRubberStampAnnotation = page.annotations.at(0) as PdfRubberStampAnnotation;
* // Gets the icon type of the rubber stamp annotation.
* let icon: PdfRubberStampAnnotationIcon = annotation.icon;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the icon type of the rubber stamp annotation.
*
* @param {PdfRubberStampAnnotationIcon} value Annotation icon.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRubberStampAnnotation = page.annotations.at(0) as PdfRubberStampAnnotation;
* // Sets the icon type of the rubber stamp annotation.
* annotation.icon = PdfRubberStampAnnotationIcon.completed;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
icon: PdfRubberStampAnnotationIcon;
/**
* Get the appearance of the rubber stamp annotation. (Read only)
*
* @returns {PdfAppearance} Returns the appearance of the annotation.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new rubber stamp annotation
* const annotation: PdfRubberStampAnnotation = new PdfRubberStampAnnotation({x: 50, y: 100, width: 100, height: 50});
* // Get the appearance of the annotation
* let appearance: PdfAppearance = annotation.appearance;
* // Access the normal template of the appearance
* let template: PdfTemplate = appearance.normal;
* // Create new image object by using JPEG image data as Base64 string format
* let image: PdfImage = new PdfBitmap('/9j/4AAQSkZJRgABAQEAkACQAAD/4....QB//Z');
* // Draw the image as the custom appearance for the annotation
* template.graphics.drawImage(image, {x: 0, y: 0, width: 100, height: 50});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
readonly appearance: PdfAppearance;
/**
* Create an appearance template for a rubber stamp annotation.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRubberStampAnnotation = page.annotations.at(0) as PdfRubberStampAnnotation;
* // Gets the appearance template of the annotation.
* let template: PdfTemplate = annotation.createTemplate();
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*
* @returns {PdfTemplate} Returns the appearance template of the annotation.
*/
createTemplate(): PdfTemplate;
/**
* Returns the inner appearance bounds for a loaded stamp, aligning its x/y with the annotations current bounds.
*
* @private
* @returns {{x: number, y: number, width: number, height: number}} The inner appearance rectangle.
*/
readonly _innerTemplateBounds: {
x: number;
y: number;
width: number;
height: number;
};
/**
* Loads a rubberstamp annotation from the given page and dictionary and initializes it as a loaded instance.
*
* @private
* @param {PdfPage} page The page that contains the annotation.
* @param {_PdfDictionary} dictionary The source annotation dictionary.
* @returns {PdfRubberStampAnnotation} The loaded rubberstamp annotation instance.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfRubberStampAnnotation;
/**
* Initializes the rubber stamp annotation for the specified page and optional source dictionary.
*
* @private
* @param {PdfPage} page The page to associate with this annotation.
* @param {_PdfDictionary} [dictionary] Optional source dictionary to import from.
* @returns {void} No return value.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Finalizes setup by ensuring BS/color defaults and either parsing an existing AP stream or creating a new rubberstamp appearance.
*
* @private
* @returns {void} No return value.
*/
_postProcess(): void;
/**
* Creates, parses, or imports the stamp appearance based on export/flatten/rotation state, handles popup flattening, and flattens or removes the annotation when needed.
*
* @private
* @param {boolean} [isFlatten=false] When true, flattens the annotation into page content and removes the annotation entry.
* @returns {void} No return value.
*/
_doPostProcess(isFlatten?: boolean): void;
/**
* Parses the normal appearance stream (AP/N), resolves rotation and BBox/Matrix, updates the template size, and indicates if BBox transformation is required.
*
* @private
* @returns {boolean} True when the BBox must be transformed during flattening; otherwise, false.
*/
_parseStampAppearance(): boolean;
/**
* Builds the rubber stamp appearance (icon name, rotation, drawing), registers the AP stream/reference, updates Border and Rect, and returns the template.
*
* @private
* @returns {PdfTemplate} The generated appearance template.
*/
_createRubberStampAppearance(): PdfTemplate;
/**
* Renders the rubberstamp artwork into the provided template using scaling, transparency, and the configured appearance font.
*
* @private
* @param {PdfTemplate} template The template whose graphics will receive the rendered stamp.
* @returns {void} No return value.
*/
_drawStampAppearance(template: PdfTemplate): void;
/**
* Maps the rubberstamp icon enum to its display name and updates the baseline stamp width for layout.
*
* @private
* @param {PdfRubberStampAnnotationIcon} icon The icon enum value.
* @returns {string} The human readable icon name.
*/
_obtainIconName(icon: PdfRubberStampAnnotationIcon): string;
/**
* Returns the background color for the current stamp icon category (approval/warning/neutral palette).
*
* @private
* @returns {PdfColor} The background color.
*/
_obtainBackGroundColor(): PdfColor;
/**
* Returns the border/text color for the current stamp icon category (approval/warning/neutral palette).
*
* @private
* @returns {PdfColor} The border and text color.
*/
_obtainBorderColor(): PdfColor;
/**
* Draws the rounded stamp shape and centered uppercase label using the provided pen, brush, and font.
*
* @private
* @param {PdfGraphics} graphics The graphics context to draw on.
* @param {PdfPen} pen The outline pen for the rounded rectangle.
* @param {PdfBrush} brush The fill brush for the rounded rectangle.
* @param {PdfStandardFont} font The font used to render the stamp text.
* @param {PdfStringFormat} format The string format for alignment.
* @returns {void} No return value.
*/
_drawRubberStamp(graphics: PdfGraphics, pen: PdfPen, brush: PdfBrush, font: PdfStandardFont, format: PdfStringFormat): void;
/**
* Extracts and returns the inner bounds from the normal appearance streams BBox if present.
*
* @private
* @returns {{x: number, y: number, width: number, height: number}} The inner bounds rectangle, or zeros when unavailable.
*/
_obtainInnerBounds(): {
x: number;
y: number;
width: number;
height: number;
};
}
/**
* `PdfSoundAnnotation` class represents the sound annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access first page
* let page: PdfPage = document.getPage(0);
* // Access the annotation at index 0
* let annotation: PdfSoundAnnotation = page.annotations.at(0) as PdfSoundAnnotation;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfSoundAnnotation extends PdfComment {
/**
* Initializes a new instance of the `PdfSoundAnnotation` class.
*
* @private
*/
constructor();
/**
* Loads a sound annotation from the given page and dictionary and initializes it as a loaded instance.
*
* @private
* @param {PdfPage} page The page that contains the annotation.
* @param {_PdfDictionary} dictionary The source annotation dictionary.
* @returns {PdfSoundAnnotation} The loaded sound annotation instance.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfSoundAnnotation;
/**
* Loads a sound annotation from the given page and dictionary and initializes it as a loaded instance.
*
* @private
* @param {PdfPage} page The page that contains the annotation.
* @param {_PdfDictionary} dictionary The source annotation dictionary.
* @returns {void} nothing.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Performs flattening for sound annotations by importing the appearance stream when available or removing the annotation if none exists.
*
* @private
* @param {boolean} [isFlatten=false] When true, attempts to flatten the annotation into the page; otherwise, no action.
* @returns {void} No return value.
*/
_doPostProcess(isFlatten?: boolean): void;
}
/**
* `PdfFreeTextAnnotation` class represents the free text annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new free text annotation
* const annotation: PdfFreeTextAnnotation = new PdfFreeTextAnnotation({x: 50, y: 100, width: 100, height: 50});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfFreeTextAnnotation extends PdfComment {
/**
* Contains the callout line points associated with the annotation.
*
* @private
*/
_calloutLines: Array<Point>;
/**
* Holds a cloned copy of callout line coordinates.
*
* @private
*/
_calloutsClone: Array<number[]>;
/**
* Stores rich-content or RC text for the annotation.
*
* @private
*/
_rcText: string;
/**
* Defines the markup color applied to the free text background or border.
*
* @private
*/
_textMarkUpColor: PdfColor;
/**
* Font used to render the free text content.
*
* @private
*/
_font: PdfFont;
/**
* Color used to draw the free text glyphs.
*
* @private
*/
_textColor: PdfColor;
/**
* Color used to draw the annotation border.
*
* @private
*/
_borderColor: PdfColor;
/**
* Stores an optional intent description string for the annotation.
*
* @private
*/
_intentString: string;
/**
* Indicates whether the annotation content was updated.
*
* @private
*/
_isContentUpdated: boolean;
/**
* Default font used for markup elements within the free text annotation.
*
* @private
*/
_markUpFont: PdfStandardFont;
private _annotationIntent;
private _lineEndingStyle;
private _textAlignment;
private _cropBoxValueX;
private _cropBoxValueY;
private _paddings;
private _parsedXMLData;
private _innerTextBoxBounds;
/**
* Initializes a new instance of the `PdfFreeTextAnnotation` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfFreeTextAnnotation` class.
*
* @param {Rectangle} bounds Bounds.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new free text annotation
* const annotation: PdfFreeTextAnnotation = new PdfFreeTextAnnotation({x: 50, y: 100, width: 100, height: 50});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle);
/**
* Initializes a new instance of the `PdfFreeTextAnnotation` class with bounds and optional properties.
*
* @param {Rectangle} bounds Free text (text box) bounds.
* @param {object} [properties] Optional customization properties.
* @param {Point[]} [properties.calloutLines] Callout leader line points (2 or 3 points) when using callout intent.
* @param {PdfLineEndingStyle} [properties.lineEndingStyle] Line ending style for the callout (e.g., openArrow, closedArrow).
* @param {PdfAnnotationIntent} [properties.annotationIntent] Annotation intent (e.g., freeTextCallout, freeTextTypeWriter).
* @param {PdfColor} [properties.borderColor] Border color of the text box.
* @param {PdfTextAlignment} [properties.textAlignment] Text alignment inside the text box (left/center/right/justify).
* @param {PdfFont} [properties.font] Font used for the text content.
* @param {string} [properties.text] Content text to be displayed in the text box.
* @param {string} [properties.author] Author of the annotation.
* @param {string} [properties.subject] Subject of the annotation.
* @param {PdfColor} [properties.textMarkUpColor] Text color (RGB) of the content inside the box.
* @param {PdfColor} [properties.innerColor] Fill color of the text box.
* @param {number} [properties.opacity] Opacity value from 0 to 1.
* @param {PdfAnnotationBorder} [properties.border] Border configuration (width, style, dash).
* ```typescript
* // Load an existing PDF document
* const document = new PdfDocument(data, password);
* // Get the first page
* const page = document.getPage(0);
* // Create new free text annotation
* const callout = new PdfFreeTextAnnotation({ x: 250, y: 260, width: 180, height: 80 },
* { text: 'Review this chart value.',
* annotationIntent: PdfAnnotationIntent.freeTextCallout,
* calloutLines: [{ x: 200, y: 320 }, { x: 260, y: 300 }, { x: 260, y: 300 }],
* lineEndingStyle: PdfLineEndingStyle.openArrow,
* font: new PdfStandardFont(PdfFontFamily.helvetica, 9, PdfFontStyle.italic),
* textMarkUpColor: { r: 40, g: 40, b: 40 },
* innerColor: { r: 240, g: 248, b: 255 },
* borderColor: { r: 0, g: 0, b: 0 },
* textAlignment: PdfTextAlignment.left,
* opacity: 1,
* border: new PdfAnnotationBorder({width: 1, hRadius: 0, vRadius: 0, style: PdfBorderStyle.solid})}
* );
* // Add annotation to the page
* page.addAnnotation(callout);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle, properties: {
calloutLines?: Point[];
lineEndingStyle?: PdfLineEndingStyle;
annotationIntent?: PdfAnnotationIntent;
borderColor?: PdfColor;
textAlignment?: PdfTextAlignment;
font?: PdfFont;
text?: string;
author?: string;
subject?: string;
textMarkUpColor?: PdfColor;
innerColor?: PdfColor;
opacity?: number;
border?: PdfAnnotationBorder;
});
/**
* Gets the callout lines of the free text annotation.
*
* @returns {Array<Point>} Callout lines.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfFreeTextAnnotation= page.annotations.at(0) as PdfFreeTextAnnotation;
* // Gets the callout lines of the free text annotation.
* let calloutLines: Array<Point[]> = annotation.calloutLines;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the callout lines of the free text annotation.
*
* @param {Array<Point>} value Callout lines.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfFreeTextAnnotation = page.annotations.at(0) as PdfFreeTextAnnotation;
* // Sets the callout lines of the free text annotation.
* annotation.calloutLines = [{x: 100, y: 450}, {x: 100, y: 200}, {x: 100, y: 150}];
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
calloutLines: Array<Point>;
/**
* Gets the line ending style of the annotation.
*
* @returns {PdfLineEndingStyle} Line ending style.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfFreeTextAnnotation = page.annotations.at(0) as PdfFreeTextAnnotation;
* // Gets the Line ending style of the annotation.
* let lineEndingStyle: PdfLineEndingStyle = annotation.lineEndingStyle;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the line ending style of the line annotation.
*
* @param {PdfLineEndingStyle} value Line ending style.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfFreeTextAnnotation = page.annotations.at(0) as PdfFreeTextAnnotation;
* // Sets the line ending style of the line annotation.
* annotation.lineEndingStyle = PdfLineEndingStyle.closedArrow;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
lineEndingStyle: PdfLineEndingStyle;
/**
* Gets the text markup color of the annotation.
*
* @returns {PdfColor} Text markup color as R, G, B color array in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfFreeTextAnnotation = page.annotations.at(0) as PdfFreeTextAnnotation;
* // Gets the text markup color of the annotation.
* let textMarkUpColor: PdfColor = annotation.textMarkUpColor;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the text markup color of the annotation.
*
* @param {PdfColor} value R, G, B color values in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfFreeTextAnnotation = page.annotations.at(0) as PdfFreeTextAnnotation;
* // Sets the text markup color of the annotation.
* annotation.textMarkUpColor = {r: 200, g: 200, b: 200};
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
textMarkUpColor: PdfColor;
/**
* Gets the text alignment of the annotation.
*
* @returns {PdfTextAlignment} Text alignment.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfFreeTextAnnotation = page.annotations.at(0) as PdfFreeTextAnnotation;
* // Gets the text alignment of the annotation.
* let textAlignment: PdfTextAlignment = annotation.textAlignment;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the text alignment of the annotation.
*
* @param {PdfTextAlignment} value Text alignment.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfFreeTextAnnotation = page.annotations.at(0) as PdfFreeTextAnnotation;
* // Sets the text alignment of the annotation.
* annotation.textAlignment = PdfTextAlignment.justify;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
textAlignment: PdfTextAlignment;
/**
* Gets the font of the annotation.
*
* @returns {PdfFont} font.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfFreeTextAnnotation = page.annotations.at(0) as PdfFreeTextAnnotation;
* // Gets the font of the annotation.
* let font: PdfFont = annotation.font;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the font of the annotation.
*
* @param {PdfFont} value font.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfFreeTextAnnotation = page.annotations.at(0) as PdfFreeTextAnnotation;
* // Sets the font of the annotation.
* annotation.font = document.embedFont(PdfFontFamily.helvetica, 10, PdfFontStyle.regular);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
font: PdfFont;
/**
* Gets the border color of the annotation.
*
* @returns {PdfColor} R, G, B color values in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfFreeTextAnnotation = page.annotations.at(0) as PdfFreeTextAnnotation;
* // Gets the border color of the annotation.
* let borderColor: PdfColor = annotation.borderColor;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the border color of the annotation.
*
* @param {PdfColor} value R, G, B color values in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfFreeTextAnnotation = page.annotations.at(0) as PdfFreeTextAnnotation;
* // Sets the border color of the annotation.
* annotation.borderColor = {r: 150, g: 150, b: 150};
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
borderColor: PdfColor;
/**
* Gets the intent of the annotation.
*
* @returns {PdfAnnotationIntent} Annotation intent.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfFreeTextAnnotation = page.annotations.at(0) as PdfFreeTextAnnotation;
* // Gets the intent of the annotation.
* let annotationIntent: PdfAnnotationIntent = annotation.annotationIntent;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the intent of the annotation.
*
* @param {PdfAnnotationIntent} value Annotation intent.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfFreeTextAnnotation = page.annotations.at(0) as PdfFreeTextAnnotation;
* // Sets the intent of the annotation.
* annotation.annotationIntent = PdfAnnotationIntent.freeTextTypeWriter;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
annotationIntent: PdfAnnotationIntent;
/**
* Returns the annotations MK appearance characteristics dictionary if present.
*
* @private
* @returns {_PdfDictionary} The MK dictionary or undefined when absent.
*/
readonly _mkDictionary: _PdfDictionary;
/**
* Computes and returns the inner text box bounds, aligning to the annotations position and honoring callout lines.
*
* @private
* @returns {{x: number, y: number, width: number, height: number}} The inner text box rectangle.
*/
readonly _innerBounds: Rectangle;
/**
* Loads a free text annotation from the given page and dictionary, marks it as loaded, parses RC if present, and initializes internal state.
*
* @private
* @param {PdfPage} page The page that contains the annotation.
* @param {_PdfDictionary} dictionary The source annotation dictionary.
* @returns {PdfFreeTextAnnotation} The loaded free text annotation instance.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfFreeTextAnnotation;
/**
* Sets the free text internal padding values used to insert text within the annotation rectangle.
*
* @private
* @param {_PdfPaddings} paddings The paddings to apply (left/top/right/bottom).
* @returns {void} No return value.
*/
_setPaddings(paddings: _PdfPaddings): void;
/**
* Initializes the free text annotation for the specified page and optional source dictionary.
*
* @private
* @param {PdfPage} page The page to associate with this annotation.
* @param {_PdfDictionary} [dictionary] Optional source dictionary to import from.
* @returns {void} No return value.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Finalizes setup: validates bounds, ensures BS/color defaults, captures Crop/MediaBox offsets, creates appearance when needed, and persists the dictionary for non flattened cases.
*
* @private
* @param {boolean} isFlatten When true, prepares for flattening by generating appearance immediately.
* @returns {void} No return value.
*/
_postProcess(isFlatten: boolean): void;
/**
* Builds or imports the appearance based on state/flattening, flattens when appropriate, updates style if RC changed, and writes AP entries for non flattened output.
*
* @private
* @param {boolean} [isFlatten=false] When true, flattens the annotation into page content and removes it.
* @returns {void} No return value.
*/
_doPostProcess(isFlatten?: boolean): void;
/**
* Validates the template Matrix/BBox against target bounds; if misaligned, draws directly to page and removes the annotation.
*
* @private
* @param {_PdfDictionary} dictionary The appearance stream dictionary to validate.
* @param {any} bounds The target placement rectangle.
* @param {PdfTemplate} appearanceTemplate The template to draw when fixing placement.
* @returns {boolean} True if the template matrix is valid; otherwise, false.
*/
_isValidTemplateMatrix(dictionary: _PdfDictionary, bounds: {
x: number;
y: number;
width: number;
height: number;
}, appearanceTemplate: PdfTemplate): boolean;
/**
* Creates the free text appearance template, applies rotation/opacity, updates RD/Rect, and returns the template.
*
* @private
* @returns {PdfTemplate} The generated appearance template.
*/
_createAppearance(): PdfTemplate;
/**
* Calculates and updates the RD array by comparing inner and outer appearance bounds.
*
* @private
* @param {number[]} innerRectangle The inner rectangle [x, y, w, h] in appearance coordinates.
* @returns {void} No return value.
*/
_calculateRectangle(innerRectangle: number[]): void;
/**
* Maps the annotation intent enum to its PDF intent name string and returns it.
*
* @private
* @param {PdfAnnotationIntent} _annotationIntent The intent enum to map.
* @returns {string} The PDF intent name (e.g., 'FreeTextCallout').
*/
_obtainAnnotationIntent(_annotationIntent: PdfAnnotationIntent): string;
/**
* Resolves the effective font including RC overrides when present and returns a mapped PdfFont instance.
*
* @private
* @returns {PdfFont} The resolved font for rendering.
*/
_obtainFont(): PdfFont;
/**
* Maps a PdfFontFamily numeric identifier to its canonical font family name.
*
* @private
* @param {number} value The numeric PdfFontFamily value.
* @returns {string} The canonical font family name.
*/
_getFontFamily(value: number): string;
/**
* Updates DS and RC with font, color, alignment, and decoration styles derived from the provided font and brush.
*
* @private
* @param {PdfFont} font The font to encode into DS/RC.
* @param {PdfColor} color The RGB text color to apply.
* @param {PdfTextAlignment} alignment The paragraph alignment for text.
* @returns {void} No return value.
*/
_updateStyle(font: PdfFont, color: PdfColor, alignment: PdfTextAlignment): void;
/**
* Draws the free text content within the computed bounds, applying padding, rotation handling, and string formatting.
*
* @private
* @param {PdfGraphics} graphics The graphics context.
* @param {_PaintParameter} parameter Paint parameters (pens/brushes/bounds).
* @param {number[]} rectangle The drawing rectangle [x, y, w, h] (appearance coords).
* @param {string} text The text to render.
* @param {PdfTextAlignment} alignment The line alignment (left/center/right/justify).
* @returns {void} No return value.
*/
_drawFreeMarkUpText(graphics: PdfGraphics, parameter: _PaintParameter, rectangle: number[], text: string, alignment: PdfTextAlignment): void;
/**
* Renders the text box background/border or cloud appearance with rotation handling, then delegates text rendering.
*
* @private
* @param {PdfGraphics} graphics The graphics context.
* @param {_PaintParameter} parameter Paint parameters (pens/brushes/bounds).
* @param {number[]} rectangle The rectangle [x, y, w, h] (appearance coords).
* @param {PdfTextAlignment} alignment Text alignment for content drawing.
* @returns {void} No return value.
*/
_drawFreeTextRectangle(graphics: PdfGraphics, parameter: _PaintParameter, rectangle: number[], alignment: PdfTextAlignment): void;
/**
* Draws the cloud style rectangle appearance when BE/I is set by constructing a path and invoking the cloud drawer.
*
* @private
* @param {PdfGraphics} graphics The graphics context.
* @param {_PaintParameter} parameter Paint parameters including brushes and pen.
* @param {number[]} rectangle The rectangle [x, y, w, h] to outline/fill.
* @returns {void} No return value.
*/
_drawAppearance(graphics: PdfGraphics, parameter: _PaintParameter, rectangle: number[]): void;
/**
* Draws the free text annotation: either the filled rectangle or the text string using the specified font, brushes, and bounds.
*
* @private
* @param {PdfGraphics} g The graphics context.
* @param {_PaintParameter} parameter Paint parameters containing pens/brushes/bounds.
* @param {string} text The text to render; empty to draw only background/border.
* @param {PdfFont} font The font to use for text rendering.
* @param {number[]} rectangle The drawing rectangle [x, y, w, h].
* @param {boolean} isSkipDrawRectangle When true, skips drawing the rectangle and draws only text.
* @param {PdfTextAlignment} alignment The text alignment inside the rectangle.
* @param {boolean} isRotation When true, the text is drawn with rotation transforms applied.
* @returns {void} No return value.
*/
_drawFreeTextAnnotation(g: PdfGraphics, parameter: _PaintParameter, text: string, font: PdfFont, rectangle: number[], isSkipDrawRectangle: boolean, alignment: PdfTextAlignment, isRotation: boolean): void;
/**
* Retrieves callout line points from the CL entry and converts them into page coordinates.
*
* @private
* @returns {Array<Point>} The callout polyline points as page coordinates.
*/
_getCalloutLinePoints(): Array<Point>;
/**
* Computes the appearance bounding box from callout lines and the text box and returns it as [x, y, w, h].
*
* @private
* @returns {number[]} The appearance bounds [x, y, width, height].
*/
_obtainAppearanceBounds(): number[];
/**
* Converts callout line points to native appearance coordinates considering margins and Crop/MediaBox offsets.
*
* @private
* @returns {void} No return value.
*/
_obtainCallOutsNative(): void;
/**
* Returns the two callout line endpoints as a flat [x1, y1, x2, y2] array in native coordinates.
*
* @private
* @returns {number[]} The endpoints in appearance coordinates.
*/
_obtainLinePoints(): number[];
/**
* Reads the LE entry and returns the mapped PdfLineEndingStyle for the callout line.
*
* @private
* @returns {PdfLineEndingStyle} The resolved line ending style.
*/
_obtainLineEndingStyle(): PdfLineEndingStyle;
/**
* Obtains the display text from Contents or RC backup, caching it in the instance when found.
*
* @private
* @returns {string} The resolved text content (may be empty).
*/
_obtainText(): string;
/**
* Determines the text alignment from Q, RC, or DS entries and returns the resolved PdfTextAlignment.
*
* @private
* @returns {PdfTextAlignment} The resolved text alignment.
*/
_obtainTextAlignment(): PdfTextAlignment;
/**
* Resolves the border/text color from DA/MK/BC when loaded or from the configured border color when creating.
*
* @private
* @returns {PdfColor} The resolved RGB color.
*/
_obtainColor(): PdfColor;
/**
* Expands the first callout point outward to accommodate end styles and border thickness relative to the text box.
*
* @private
* @param {Point[]} pointArray The callout points to adjust (mutated in place).
* @returns {void} No return value.
*/
_expandAppearance(pointArray: Point[]): void;
/**
* Draws the callout polyline path derived from the callout points using the specified border pen.
*
* @private
* @param {PdfGraphics} graphics The graphics context.
* @param {PdfPen} borderPen The pen used to draw the callout path.
* @returns {void} No return value.
*/
_drawCallOuts(graphics: PdfGraphics, borderPen: PdfPen): void;
/**
* Persists the free text dictionary entries (Contents, Q, Subj/IT, DS, DA, CL, Rect) based on current state and intent.
*
* @private
* @returns {void} No return value.
*/
_saveFreeTextDictionary(): void;
/**
* Escapes XML sensitive characters (&, <, >) in the provided markup text for RC storage.
*
* @private
* @param {string} markupText The raw markup text to escape.
* @returns {string} The escaped XML safe string.
*/
_getXmlFormattedString(markupText: string): string;
/**
* Parses RC XHTML content to extract style directives, resolve fonts/brushes/alignment, and populate the parsed XML font collection.
*
* @private
* @param {string} rcContent The RC XHTML content to parse.
* @returns {any[]} A collection of [font, alignment, namespaceURI, brush] entries.
*/
_parseMarkupLanguageData(rcContent: string): any[];
/**
* Traverses the XHTML DOM and collects inline style attributes per tag into a style map.
*
* @private
* @param {HTMLElement} root The root element to traverse.
* @param {Map<string, string[]>} [styleMap] Optional existing map to append into.
* @returns {Map<string, string[]>} The populated map of tagName → style declarations.
*/
_collectStyles(root: HTMLElement, styleMap?: Map<string, string[]>): Map<string, string[]>;
/**
* Flattens the collected style map into a string array of CSS property declarations.
*
* @private
* @param {Map<string, string[]>} styleMap The map of style declarations per tag.
* @returns {string[]} The flattened CSS declarations.
*/
_extractStylesToInput(styleMap: Map<string, string[]>): string[];
/**
* Returns true if the character is in common symbol Unicode ranges used for special glyphs.
*
* @private
* @param {string} char The character to test.
* @returns {boolean} True if the character is a symbol glyph; otherwise, false.
*/
_isSymbol(char: string): boolean;
/**
* Applies parsed style properties to update font name/size/style, text alignment, brush, and spacerun content, returning the updated values.
*
* @private
* @param {Map<string, any>} fontDetails The parsed font/style details map.
* @param {string} fontName The current font family name.
* @param {PdfFontStyle} fontStyle The current font style flags.
* @param {PdfBrush} brush The current text brush (may be updated).
* @returns {{ fontName: string, fontStyle: PdfFontStyle, brush: PdfBrush }} The updated font properties.
*/
_updateFontProperties(fontDetails: Map<string, any>, fontName: string, fontStyle: PdfFontStyle, brush: PdfBrush): {
fontName: string;
fontStyle: PdfFontStyle;
brush: PdfBrush;
};
/**
* Converts a bitmask value into a PdfFontStyle subset with regular as fallback.
*
* @private
* @param {number} value The bitmask to convert.
* @returns {PdfFontStyle} The mapped PdfFontStyle.
*/
_getStyles(value: number): PdfFontStyle;
/**
* Returns the maximum PdfFontStyle value between two style flags.
*
* @private
* @param {PdfFontStyle} a The first style flag.
* @param {PdfFontStyle} b The second style flag.
* @returns {PdfFontStyle} The dominant style flag.
*/
_maxStyle(a: PdfFontStyle, b: PdfFontStyle): PdfFontStyle;
/**
* Parses a numeric alignment value and returns the corresponding PdfTextAlignment enum.
*
* @private
* @param {string} value The numeric alignment value as a string.
* @returns {PdfTextAlignment} The parsed alignment (left/center/right/justify).
*/
_parseTextAlignment(value: string): PdfTextAlignment;
/**
* Parses a list of CSS declarations into effective font details, color brush, and alignment, returning them in a detail map.
*
* @private
* @param {string[]} input The CSS declarations.
* @param {number} fontSize The current font size used as fallback.
* @param {PdfTextAlignment} textAlignment The current text alignment used as fallback.
* @param {PdfFontStyle} fontStyle The current font style flags used as fallback.
* @param {PdfBrush} brush The current brush used as fallback.
* @returns {Map<string, any>} A map containing resolved font properties and brush.
*/
_getFontDetails(input: string[], fontSize: number, textAlignment: PdfTextAlignment, fontStyle: PdfFontStyle, brush: PdfBrush): Map<string, any>;
/**
* Parses a composite CSS font shorthand into family and size, updating the font details map.
*
* @private
* @param {string} value The CSS font shorthand value.
* @param {Map<string, any>} fontDetails The map to receive parsed properties.
* @returns {void} No return value.
*/
_parseFont(value: string, fontDetails: Map<string, any>): void;
/**
* Parses a CSS point size string (e.g., '12pt') into a numeric value.
*
* @private
* @param {string} value The CSS point size string.
* @returns {number} The parsed size in points.
*/
_parseFontSize(value: string): number;
/**
* Updates the PdfFontStyle with bold when the font weight property indicates bold.
*
* @private
* @param {string} value The CSS font weight value.
* @param {PdfFontStyle} fontStyle The current font style flags.
* @returns {PdfFontStyle} The updated font style flags.
*/
_parseFontWeight(value: string, fontStyle: PdfFontStyle): PdfFontStyle;
/**
* Normalizes a CSS font family string by trimming surrounding quotes.
*
* @private
* @param {string} value The CSS font-family value.
* @returns {string} The normalized font family name.
*/
_parseFontFamily(value: string): string;
/**
* Applies font style flags (regular/underline/strikeout/italic/bold) based on the CSS font style value.
*
* @private
* @param {string} value The CSS font style value.
* @param {PdfFontStyle} fontStyle The current font style flags.
* @returns {PdfFontStyle} The updated font style flags.
*/
_parseFontStyle(value: string, fontStyle: PdfFontStyle): PdfFontStyle;
/**
* Applies underline/strikeout flags according to the CSS text decoration value.
*
* @private
* @param {string} value The CSS text decoration value.
* @param {PdfFontStyle} fontStyle The current font style flags.
* @returns {PdfFontStyle} The updated font style flags.
*/
_parseTextDecoration(value: string, fontStyle: PdfFontStyle): PdfFontStyle;
/**
* Parses a CSS text align string into a PdfTextAlignment enum value.
*
* @private
* @param {string} value The CSS text align value.
* @returns {PdfTextAlignment} The parsed alignment enum.
*/
_parseTextAlign(value: string): PdfTextAlignment;
/**
* Converts a CSS color string to a PdfColor object or throws on invalid format.
*
* @private
* @param {string} rgbString The CSS color string (rgb(r,g,b) or #RRGGBB).
* @returns {PdfColor} The parsed RGB color.
*/
_rgbStringToArray(rgbString: string): PdfColor;
/**
* Appends the resolved font, alignment, namespace URI, and brush to the running parsed XML font collection and returns it.
*
* @private
* @param {any[]} fontCollection The existing collection to append to.
* @param {PdfFont} font The resolved font instance.
* @param {string} nameSpaceUri The namespace URI found in RC.
* @param {PdfTextAlignment} alignment The text alignment value.
* @param {PdfBrush} brush The resolved brush.
* @returns {any[]} The updated font collection.
*/
_fontCollection(fontCollection: any[], font: PdfFont, nameSpaceUri: string, alignment: PdfTextAlignment, brush: PdfBrush): any[];
}
/**
* `PdfRedactionAnnotation` class represents the redaction annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new redaction annotation
* const annotation: PdfRedactionAnnotation = new PdfRedactionAnnotation({x: 50, y: 100, width: 100, height: 50});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfRedactionAnnotation extends PdfComment {
private _overlayText;
private _repeat;
private _font;
private _textColor;
private _borderColor;
private _textAlignment;
private _appearanceFillColor;
/**
* Initializes a new instance of the `PdfRedactionAnnotation` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfRedactionAnnotation` class.
*
* @param {Rectangle} bounds Bounds.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new redaction annotation
* const annotation: PdfRedactionAnnotation = new PdfRedactionAnnotation({x: 10, y: 50, width: 250, height: 50});
* // Add annotation to the page
* page.annotations.add(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle);
/**
* Initializes a new instance of the `PdfRedactionAnnotation` class.
*
* @param {Rectangle} bounds redaction bounds.
* @param {object} [properties] Optional customization properties.
* @param {PdfColor} [properties.borderColor] Border color.
* @param {boolean} [properties.repeatText] Repeat the overlay text.
* @param {string} [properties.overlayText] Overlay text.
* @param {PdfFont} [properties.font] Font used for the overlay text.
* @param {PdfColor} [properties.textColor] Text color.
* @param {PdfColor} [properties.appearanceFillColor] Fill color for the appearance.
* @param {PdfColor} [properties.innerColor] Inner color.
* @param {PdfTextAlignment} [properties.textAlignment] Alignment.
* @param {string} [properties.text] Additional text content.
* @param {string} [properties.author] Author.
* @param {string} [properties.subject] Subject.
* @param {number} [properties.opacity] Opacity.
* @param {Rectangle[]} [properties.boundsCollection] Bounds collection.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Create a new redaction annotation
* const annot: PdfRedactionAnnotation = new PdfRedactionAnnotation({x: 100, y: 100, width: 100, height: 100},
* { borderColor: {r: 255, g: 0, b: 0},
* repeatText: true,
* overlayText: 'Sample Overlay',
* font: document.embedFont(PdfFontFamily.helvetica, 10, PdfFontStyle.regular),
* textColor: {r: 0, g: 0, b: 0},
* appearanceFillColor: {r: 255, g: 255, b: 255} });
* // Add annotation to the page
* page.addAnnotation(annotation);
* // Destroy the document
* document.destroy();
* ```
*/
constructor(bounds: Rectangle, properties: {
borderColor?: PdfColor;
repeatText?: boolean;
overlayText?: string;
font?: PdfFont;
textColor?: PdfColor;
appearanceFillColor?: PdfColor;
innerColor?: PdfColor;
textAlignment?: PdfTextAlignment;
text?: string;
author?: string;
subject?: string;
opacity?: number;
boundsCollection?: Rectangle[];
});
/**
* Gets the boolean flag indicating whether annotation has repeat text or not.
*
* @returns {boolean} repeat text.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRedactionAnnotation = page.annotations.at(0) as PdfRedactionAnnotation;
* // Gets the boolean flag indicating whether annotation has repeat text or not.
* let repeatText: boolean = annotation. repeatText;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the boolean flag indicating whether annotation has repeat text or not.
*
* @param {boolean} value repeat text.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRedactionAnnotation = page.annotations.at(0) as PdfRedactionAnnotation;
* // Sets the boolean flag indicating whether annotation has repeat text or not.
* annotation.repeatText = false;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
repeatText: boolean;
/**
* Gets the text alignment of the annotation.
*
* @returns {PdfTextAlignment} Text alignment.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRedactionAnnotation = page.annotations.at(0) as PdfRedactionAnnotation;
* // Gets the text alignment of the annotation.
* let textAlignment: PdfTextAlignment = annotation.textAlignment;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the text alignment of the annotation.
*
* @param {PdfTextAlignment} value Text alignment.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRedactionAnnotation = page.annotations.at(0) as PdfRedactionAnnotation;
* // Sets the text alignment of the annotation.
* annotation.textAlignment = PdfTextAlignment.justify;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
textAlignment: PdfTextAlignment;
/**
* Gets the text color of the annotation.
*
* @returns {PdfColor} R, G, B color values in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRedactionAnnotation = page.annotations.at(0) as PdfRedactionAnnotation;
* // Gets the text color of the annotation.
* let textColor : PdfColor = annotation.textColor;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the text color of the annotation.
*
* @param {PdfColor} value R, G, B color values in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRedactionAnnotation = page.annotations.at(0) as PdfRedactionAnnotation;
* // Sets the text color of the annotation.
* annotation.textColor = {r: 255, g: 255, b: 255};
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
textColor: PdfColor;
/**
* Gets the border color of the annotation.
*
* @returns {PdfColor} R, G, B color values in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRedactionAnnotation = page.annotations.at(0) as PdfRedactionAnnotation;
* // Gets the border color of the annotation.
* let borderColor: PdfColor = annotation.borderColor;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the border color of the annotation.
*
* @param {PdfColor} value R, G, B color values in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRedactionAnnotation = page.annotations.at(0) as PdfRedactionAnnotation;
* // Sets the border color of the annotation.
* annotation.borderColor = {r: 255, g: 255, b: 255};
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
borderColor: PdfColor;
/**
* Gets the overlay text of the annotation.
*
* @returns {string} overlay text.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRedactionAnnotation = page.annotations.at(0) as PdfRedactionAnnotation;
* // Gets the overlay text of the annotation.
* let overlayText: string = annotation.overlayText;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the overlay text of the annotation.
*
* @param {string} value overlay text.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRedactionAnnotation = page.annotations.at(0) as PdfRedactionAnnotation;
* // Sets the overlay text of the annotation.
* annotation.overlayText = 'syncfusion';
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
overlayText: string;
/**
* Gets the font of the annotation.
*
* @returns {PdfFont} font.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRedactionAnnotation = page.annotations.at(0) as PdfRedactionAnnotation;
* // Gets the font of the annotation.
* let font: PdfFont = annotation.font;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the font of the annotation.
*
* @param {PdfFont} value font.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRedactionAnnotation = page.annotations.at(0) as PdfRedactionAnnotation;
* // Sets the font of the annotation.
* annotation.font = document.embedFont(PdfFontFamily.helvetica, 10, PdfFontStyle.regular);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
font: PdfFont;
/**
* Gets the appearance fill color of the annotation.
*
* @returns {PdfColor} R, G, B color values in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRedactionAnnotation = page.annotations.at(0) as PdfRedactionAnnotation;
* // Gets the appearance fill color of the annotation.
* let appearanceFillColor: PdfColor = annotation.appearanceFillColor;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the appearance fill color of the annotation.
*
* @param {PdfColor} value R, G, B color values in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRedactionAnnotation = page.annotations.at(0) as PdfRedactionAnnotation;
* // Sets the appearance fill color of the annotation.
* annotation.appearanceFillColor = {r: 255, g: 255, b: 255};
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
appearanceFillColor: PdfColor;
/**
* Gets the bounds collection of the annotation.
*
* @returns {Array<Rectangle>} bounds collection.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRedactionAnnotation = page.annotations.at(0) as PdfRedactionAnnotation;
* // Gets the bounds collection of the annotation.
* let boundsCollection: Array<Rectangle> = annotation.boundsCollection;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the bounds collection of the annotation.
*
* @param {Array<Rectangle>} value bounds collection.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfRedactionAnnotation = page.annotations.at(0) as PdfRedactionAnnotation;
* // Sets the bounds collection of the annotation.
* annotation.boundsCollection = [{x: 50, y: 50, width: 100, height: 100}, {x: 201, y: 101, width: 61, height: 31}, {x: 101, y: 401, width: 61, height: 31}];
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
boundsCollection: Rectangle[];
/**
* Loads a redaction annotation from the given page and dictionary, marks it as loaded, and initializes internal state.
*
* @private
* @param {PdfPage} page The page that contains the annotation.
* @param {_PdfDictionary} dictionary The source annotation dictionary.
* @returns {PdfRedactionAnnotation} The loaded redaction annotation instance.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfRedactionAnnotation;
/**
* Initializes the redaction annotation for the specified page and optional source dictionary by delegating to the base initializer.
*
* @private
* @param {PdfPage} page The page to associate with this annotation.
* @param {_PdfDictionary} [dictionary] Optional source dictionary to import from.
* @returns {void} No return value.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Finalizes setup: validates bounds, ensures BS defaults, updates QuadPoints when changed, optionally creates the redaction appearance, and updates the Rect entry.
*
* @private
* @param {boolean} isFlatten When true, prepares for flattening by creating appearance immediately if required.
* @returns {void} No return value.
*/
_postProcess(isFlatten: boolean): void;
/**
* Builds or imports the redaction appearance based on load/flatten state and import status, applies matrix normalization when needed, and flattens or removes the annotation accordingly.
*
* @private
* @param {boolean} [isFlatten=false] When true, flattens the annotation into page content and removes it.
* @returns {void} No return value.
*/
_doPostProcess(isFlatten?: boolean): void;
/**
* Creates the redaction appearance; during non flatten flow, writes border and normal appearances to AP, or removes the annotation when flattening after creation.
*
* @private
* @param {boolean} isFlatten When true, prepares for flattening and may remove the annotation after creating the appearance.
* @returns {PdfTemplate} The normal (R) appearance template.
*/
_createRedactionAppearance(isFlatten: boolean): PdfTemplate;
/**
* Creates the border appearance template by drawing the redaction bounds with the configured pen/brush and optional opacity.
*
* @private
* @returns {PdfTemplate} The generated border (N) appearance template.
*/
_createBorderAppearance(): PdfTemplate;
/**
* Renders overlay text inside the provided rectangle across single or multiple bounds, honoring alignment and repeat settings.
*
* @private
* @param {PdfGraphics} graphics The graphics context used for drawing.
* @param {Rectangle} rectangle The reference rectangle for positioning overlay text.
* @returns {void} No return value.
*/
_drawText(graphics: PdfGraphics, rectangle: Rectangle): void;
private _drawWrappedTextAligned;
private _breakWordToFit;
private _measureText;
private _getSpaceWidth;
private _getLineHeight;
/**
* Creates the normal redaction appearance by drawing the specified bounds, applying transparency and page rotation, and rendering overlay text when present.
*
* @private
* @param {number} [index] Optional index of a specific bounds entry to render.
* @param {Rectangle} [rotatedBounds] Optional pre-rotated bounds to render.
* @param {PdfRotationAngle} [pageRotation] Optional page rotation to apply to the template.
* @returns {PdfTemplate} The generated normal appearance template.
*/
_createNormalAppearance(index?: number, rotatedBounds?: Rectangle, pageRotation?: PdfRotationAngle): PdfTemplate;
}
/**
* `PdfRichMediaAnnotation` class represents the rich media annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access first page
* let page: PdfPage = document.getPage(0);
* // Access the annotation at index 0
* let annotation: PdfRichMediaAnnotation = page.annotations.at(0) as PdfRichMediaAnnotation;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfRichMediaAnnotation extends PdfAnnotation {
/**
* Initializes a new instance of the `PdfRichMediaAnnotation` class.
*
* @private
*/
constructor();
/**
* Creates a rich media annotation from the given page and dictionary and marks it as loaded.
*
* @private
* @param {PdfPage} page The page that contains the annotation.
* @param {_PdfDictionary} dictionary The source annotation dictionary.
* @returns {PdfRichMediaAnnotation} The loaded rich media annotation instance.
*/
static _load(page: PdfPage, dictionary: _PdfDictionary): PdfRichMediaAnnotation;
/**
* Initializes the annotation using the page and optional dictionary by invoking base initialization.
*
* @private
* @param {PdfPage} page The page to associate with this annotation.
* @param {_PdfDictionary} [dictionary] Optional source dictionary to import from.
* @returns {void} No return value.
*/
_initialize(page: PdfPage, dictionary?: _PdfDictionary): void;
/**
* Performs post processing including flattening popups and appearance and removes the annotation if appearance is unavailable during flattening.
*
* @private
* @param {boolean} [isFlatten=false] When true, flattens the annotation using its appearance stream if present; otherwise removes it.
* @returns {void} No return value.
*/
_doPostProcess(isFlatten?: boolean): void;
}
/**
* `PdfWidgetAnnotation` class represents the widget annotation objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access first page
* let page: PdfPage = document.getPage(0);
* // Access the annotation at index 0
* let annotation: PdfWidgetAnnotation = page.annotations.at(0) as PdfWidgetAnnotation;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfWidgetAnnotation extends PdfAnnotation {
private _backColor;
private _borderColor;
/**
* Rotation angle applied to the widget annotation.
*
* @private
*/
_rotationAngle: number;
/**
* Visual highlight mode when interacting with the widget.
*
* @private
*/
_highlightMode: PdfHighlightMode;
/**
* Default appearance for text rendering inside the widget.
*
* @private
*/
_da: _PdfDefaultAppearance;
/**
* The underlying form field associated with this widget.
*
* @private
*/
_field: PdfField;
/**
* Enables grouping behavior for related widgets.
*
* @private
*/
_enableGrouping: boolean;
/**
* Indicates whether to resolve and use the actual field name.
*
* @private
*/
_needActualName: boolean;
/**
* Specifies the text alignment inside the widget.
*
* @private
*/
_textAlignment: PdfTextAlignment;
/**
* Enables automatic resizing of the widget to fit content.
*
* @private
*/
_isAutoResize: boolean;
/**
* Holds the index of this widget among its siblings.
*
* @private
*/
_index: number;
/**
* Controls the visibility state of the form field/widget.
*
* @private
*/
_visibility: PdfFormFieldVisibility;
/**
* Stores the name of the font used by the widget.
*
* @private
*/
_fontName: string;
/**
* Indicates whether a font has been explicitly set for the widget.
*
* @private
*/
_isFont: boolean;
/**
* When true, treats the background color as transparent.
*
* @private
*/
_isTransparentBackColor: boolean;
/**
* When true, treats the border color as transparent.
*
* @private
*/
_isTransparentBorderColor: boolean;
/**
* Initializes a new instance of the `PdfWidgetAnnotation` class.
*
* @private
*/
constructor();
/**
* Parse an existing widget annotation.
*
* @private
* @param {_PdfDictionary} dictionary Widget dictionary.
* @param {_PdfCrossReference} crossReference PDF cross reference.
* @returns {PdfWidgetAnnotation} Widget.
*/
static _load(dictionary: _PdfDictionary, crossReference: _PdfCrossReference): PdfWidgetAnnotation;
/**
* Gets the page object (Read only).
*
* @returns {PdfPage} page object.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access check box field
* let field: PdfCheckBoxField = document.form.fieldAt(0) as PdfCheckBoxField;
* // Access first item of check box field
* let item: PdfWidgetAnnotation = field.itemAt(0);
* // Gets the page object.
* let page: PdfPage = item.page;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
readonly page: PdfPage;
/**
* Gets the fore color of the annotation.
*
* @returns {PdfColor} Color as R, G, B color array in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfWidgetAnnotation = page.annotations.at(0) as PdfWidgetAnnotation;
* // Gets the fore color of the annotation.
* let color: PdfColor = annotation.color;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the fore color of the annotation.
*
* @param {PdfColor} value Color as R, G, B color array in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfWidgetAnnotation = page.annotations.at(0) as PdfWidgetAnnotation;
* // Sets the fore color of the annotation.
* annotation.color = {r: 255, g: 255, b: 255};
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
color: PdfColor;
/**
* Gets the back color of the annotation.
*
* @returns {PdfColor} Color as R, G, B color array in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access the text box field at index 0
* let field: PdfField = document.form.fieldAt(0);
* // Gets the back color of the annotation
* let backColor: PdfColor = field.itemAt(0).backColor;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the back color of the annotation.
*
* @param {PdfColor} value Array with R, G, B color values in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access the text box field at index 0
* let field: PdfField = document.form.fieldAt(0);
* // Sets the background color of the field item
* field.itemAt(0).backColor = {r: 255, g: 0, b: 0};
* // Sets the background color of the field item to transparent
* field.itemAt(1).backColor = {r: 0, g: 0, b: 0, isTransparent: true};
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
backColor: PdfColor;
/**
* Indicates whether a background color is defined for the annotation.
*
* @private
* @returns {boolean} as true or false.
*/
readonly _hasBackColor: boolean;
/**
* Indicates whether a border color is defined for the annotation.
*
* @private
* @returns {boolean} as true or false.
*/
readonly _hasBorderColor: boolean;
/**
* Gets the border color of the annotation.
*
* @returns {PdfColor} Color as R, G, B color array in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfWidgetAnnotation = page.annotations.at(0) as PdfWidgetAnnotation;
* // Gets the border color of the annotation.
* let borderColor: PdfColor = annotation.borderColor;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the border color of the annotation.
*
* @param {PdfColor} value Array with R, G, B color values in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfWidgetAnnotation = page.annotations.at(0) as PdfWidgetAnnotation;
* // Sets the border color of the annotation.
* annotation.borderColor = {r: 255, g: 255, b: 255};
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
borderColor: PdfColor;
/**
* Gets the rotation angle of the annotation.
*
* @returns {number} Rotation angle as number.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfWidgetAnnotation = page.annotations.at(0) as PdfWidgetAnnotation;
* // Gets the rotation angle of the annotation.
* let rotate: number = annotation.rotate;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the rotation angle of the annotation.
*
* @param {number} value Rotation angle as number.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfWidgetAnnotation = page.annotations.at(0) as PdfWidgetAnnotation;
* // Sets the rotation angle of the annotation.
* annotation.rotate = 90;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
rotate: number;
/**
* Gets the highlight mode of the annotation.
*
* @returns {PdfHighlightMode} Highlight mode.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfWidgetAnnotation = page.annotations.at(0) as PdfWidgetAnnotation;
* // Gets the highlight mode of the annotation.
* let highlightMode: PdfHighlightMode = annotation.highlightMode;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the highlight mode of the annotation.
*
* @param {PdfHighlightMode} value Highlight mode.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfWidgetAnnotation = page.annotations.at(0) as PdfWidgetAnnotation;
* // Sets the highlight mode of the annotation.
* annotation.highlightMode = PdfHighlightMode.noHighlighting;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
highlightMode: PdfHighlightMode;
/**
* Gets the bounds of the annotation.
*
* @returns {Rectangle} Bounds.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfWidgetAnnotation = page.annotations.at(0) as PdfWidgetAnnotation;
* // Gets the bounds of the annotation
* let bounds: Rectangle = annotation.bounds;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the bounds of the annotation.
*
* @param {Rectangle} value Bounds
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfWidgetAnnotation = page.annotations.at(0) as PdfWidgetAnnotation;
* // Sets the bounds of the annotation
* annotation.bounds = {x: 0, y: 0, width: 50, height: 50};
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
bounds: Rectangle;
/**
* Gets the text alignment of the annotation.
*
* @returns {PdfTextAlignment} Text alignment.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfWidgetAnnotation = page.annotations.at(0) as PdfWidgetAnnotation;
* // Gets the text alignment of the annotation.
* let textAlignment: PdfTextAlignment = annotation.textAlignment;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the text alignment of the annotation.
*
* @param {PdfTextAlignment} value Text alignment.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfWidgetAnnotation = page.annotations.at(0) as PdfWidgetAnnotation;
* // Sets the text alignment of the annotation
* annotation.textAlignment = PdfTextAlignment.left;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
textAlignment: PdfTextAlignment;
/**
* Gets the visibility.
*
* @returns {PdfFormFieldVisibility} Field visibility option.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access the form field at index 0
* let field: PdfField = document.form.fieldAt(0);
* // Gets the visibility
* let visibility: PdfFormFieldVisibility = field.itemAt(0).visibility;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the visibility.
*
* @param {PdfFormFieldVisibility} value Visibility option.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access the form field at index 0
* let field: PdfField = document.form.fieldAt(0);
* // Sets the visibility
* let field.itemAt(0).visibility = PdfFormFieldVisibility.hiddenPrintable;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
visibility: PdfFormFieldVisibility;
/**
* Gets the font of the item.
*
* @returns {PdfFont} font.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Access the form field at index 0
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
* // Get the first item of the field
* let item: PdfWidgetAnnotation = field.itemAt(0);
* // Gets the font of the item
* let font: PdfFont = item.font;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the font of the item.
*
* @param {PdfFont} value font.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Access the form field at index 0
* let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
* // Get the first item of the field
* let item: PdfWidgetAnnotation = field.itemAt(0);
* // Set the font of the item
* item.font = new PdfStandardFont(PdfFontFamily.helvetica, 12, PdfFontStyle.bold);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
font: PdfFont;
/**
* Gets the cached default appearance from the annotation dictionary if available.
*
* @private
* @returns {_PdfDefaultAppearance} The parsed default appearance, if any.
*/
readonly _defaultAppearance: _PdfDefaultAppearance;
/**
* Gets the cached default appearance from the annotation dictionary if available.
*
* @private
* @returns {_PdfDefaultAppearance} The parsed default appearance, if any.
*/
readonly _mkDictionary: _PdfDictionary;
/**
* Creates and initializes the widget annotation on the specified page with optional field linkage.
*
* @private
* @param {PdfPage} page The page on which to create the widget.
* @param {{x: number, y: number, width: number, height: number}} bounds The widget bounds in page coordinates. // eslint-disable-line
* @param {PdfField} [field] Optional form field to set as this widget's parent.
* @returns {_PdfDictionary} The created widget annotation dictionary.
*/
_create(page: PdfPage, bounds: {
x: number;
y: number;
width: number;
height: number;
}, field?: PdfField): _PdfDictionary;
/**
* Performs post processing to recreate or use existing appearance and optionally flattens it to the page.
*
* @private
* @param {boolean} [isFlatten=false] When true, flattens the annotation appearance into page content.
* @param {boolean} [recreateAppearance=false] When true, attempts to recreate the appearance stream.
* @returns {void} No return value.
*/
_doPostProcess(isFlatten?: boolean, recreateAppearance?: boolean): void;
/**
* Initializes and registers the font in the document resources and updates default appearance.
*
* @private
* @param {PdfFont} font The font to register and apply to this widget.
* @returns {void} No return value.
*/
_initializeFont(font: PdfFont): void;
/**
* Resolves and caches the owning page of the annotation from the document structure.
*
* @private
* @returns {PdfPage} The resolved page object, if found.
*/
_getPage(): PdfPage;
/**
* Updates the annotation rectangle before saving when bounds must be normalized to the page.
*
* @private
* @returns {void} No return value.
*/
_beginSave(): void;
/**
* Parses and returns the background color from the appearance dictionary or defaults to white.
*
* @private
* @returns {PdfColor} The resolved background color.
*/
_parseBackColor(): PdfColor;
/**
* Parses and returns the border color from the appearance dictionary or defaults to black.
*
* @private
* @returns {PdfColor} The resolved border color.
*/
_parseBorderColor(): PdfColor;
/**
* Updates the background color state and appearance flags and optionally triggers field appearance regeneration.
*
* @private
* @param {PdfColor} value The new background color (set isTransparent to remove).
* @param {boolean} [setAppearance=false] When true, marks the parent field for appearance regeneration.
* @returns {void} No return value.
*/
_updateBackColor(value: PdfColor, setAppearance?: boolean): void;
/**
* Updates the border color state and related border style entries in the appearance dictionary.
*
* @private
* @param {PdfColor} value The new border color (set isTransparent to remove).
* @returns {void} No return value.
*/
_updateBorderColor(value: PdfColor): void;
}
/**
* `PdfStateItem` class represents the check box field item objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access check box field
* let field: PdfCheckBoxField = document.form.fieldAt(0) as PdfCheckBoxField;
* // Access first item of check box field
* let item: PdfStateItem = field.itemAt(0) as PdfStateItem;
* // Sets the check box style as check
* item.style = PdfCheckBoxStyle.check;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfStateItem extends PdfWidgetAnnotation {
/**
* Specifies the visual style used for the state item.
*
* @private
*/
_style: PdfCheckBoxStyle;
/**
* Holds textual representation of the style, if any.
*
* @private
*/
_styleText: string;
/**
* Stores the export value associated with the selected state.
*
* @private
*/
_exportValue: string;
/**
* Initializes a new instance of the `PdfStateItem` class.
*
* @private
*/
constructor();
/**
* Parse an existing item of the field.
*
* @private
* @param {_PdfDictionary} dictionary Widget dictionary.
* @param {_PdfCrossReference} crossReference PDF cross reference.
* @param {PdfField} field Field object.
* @returns {PdfStateItem} Widget.
*/
static _load(dictionary: _PdfDictionary, crossReference: _PdfCrossReference, field?: PdfField): PdfStateItem;
/**
* Gets the flag to indicate whether the field item is checked or not.
*
* @returns {boolean} Checked or not.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access check box field
* let field: PdfCheckBoxField = document.form.fieldAt(0) as PdfCheckBoxField;
* // Access first item of check box field
* let item: PdfStateItem = field.itemAt(0) as PdfStateItem;
* // Gets the flag to indicate whether the field item is checked or not.
* let checked: boolean = item.checked;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the flag to indicate whether the field item is checked or not.
*
* @param {boolean} value Checked or not.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access check box field
* let field: PdfCheckBoxField = document.form.fieldAt(0) as PdfCheckBoxField;
* // Access first item of check box field
* let item: PdfStateItem = field.itemAt(0) as PdfStateItem;
* // Sets the style of the annotation
* item.checked = true;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
checked: boolean;
/**
* Gets the style of annotation.
*
* @returns {PdfCheckBoxStyle} Style of annotation.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access check box field
* let field: PdfCheckBoxField = document.form.fieldAt(0) as PdfCheckBoxField;
* // Access first item of check box field
* let item: PdfStateItem = field.itemAt(0) as PdfStateItem;
* // Gets the style of the annotation
* let style: PdfCheckBoxStyle = item.style;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the style of annotation.
*
* @param {PdfCheckBoxStyle} value Style of annotation.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access check box field
* let field: PdfCheckBoxField = document.form.fieldAt(0) as PdfCheckBoxField;
* // Access first item of check box field
* let item: PdfStateItem = field.itemAt(0) as PdfStateItem;
* // Sets the style of the annotation
* item.style = PdfCheckBoxStyle.check;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
style: PdfCheckBoxStyle;
/**
* Gets the export value of the check box field.
*
* @returns {string} Export value.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access the check box field
* let field: PdfCheckBoxField = document.form.fieldAt(0) as PdfCheckBoxField;
* // Access the first item of the check box field group
* let item: PdfStateItem = field.itemAt(0);
* // Gets the export value of the checkbox field.
* let text: sting = item.exportValue;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the export value of the check box item.
*
* @param {string} value Export value.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access the check box field
* let field: PdfCheckBoxField = document.form.fieldAt(0) as PdfCheckBoxField;
* // Access the first item of the check box field group
* let item: PdfStateItem = field.itemAt(0);
* // Sets the export value of the checkbox field.
* item.exportValue = 'CheckBox';
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
exportValue: string;
/**
* Sets the checked state and updates field and appearance dictionaries accordingly.
*
* @private
* @param {boolean} value Checked state to apply.
* @returns {void} No return value.
*/
_setCheckedStatus(value: boolean): void;
/**
* Unchecks sibling items in the same field and ensures the current item remains checked when needed.
*
* @private
* @param {PdfStateItem} child The current item being toggled.
* @param {string} value The export value used to match siblings.
* @param {boolean} isChecked Whether the current item is checked.
* @returns {void} No return value.
*/
_unCheckOthers(child: PdfStateItem, value: string, isChecked: boolean): void;
/**
* Determines the export value of the widget from its appearance or state entries.
*
* @private
* @param {PdfStateItem} item Item to inspect.
* @returns {string} The resolved export value.
*/
_tryGetExportValue(item: PdfStateItem): string;
/**
* Draws the current state appearance onto the page and finalizes the annotation update state.
*
* @private
* @returns {void} No return value.
*/
_doPostProcess(): void;
/**
* Updates the appearance state entry based on the provided or inferred value.
*
* @private
* @param {string} [value] The appearance state to set; defaults to 'Yes' or 'Off'.
* @returns {void} No return value.
*/
_postProcess(value?: string): void;
/**
* Assigns the owning field, updates formatting, and registers this item as a kid of the field.
*
* @private
* @param {PdfField} field The parent field to associate.
* @returns {void} No return value.
*/
_setField(field: PdfField): void;
}
/**
* `PdfRadioButtonListItem` class represents the radio button field item objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Gets the first page of the document
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Access the PDF form
* let form: PdfForm = document.form;
* // Create a new radio button list field
* let field: PdfRadioButtonListField = new PdfRadioButtonListField(page, 'Age');
* // Create and add first item
* let first: PdfRadioButtonListItem = field.add('1-9', {x: 100, y: 140, width: 20, height: 20});
* // Create and add second item
* let second: PdfRadioButtonListItem = new PdfRadioButtonListItem('10-49', {x: 100, y: 170, width: 20, height: 20}, page);
* field.add(second);
* // Create and add third item
* let third: PdfRadioButtonListItem = new PdfRadioButtonListItem('50-59', {x: 100, y: 200, width: 20, height: 20}, field);
* field.add(third);
* // Sets selected index of the radio button list field
* field.selectedIndex = 0;
* // Add the field into PDF form
* form.add(field);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfRadioButtonListItem extends PdfStateItem {
/**
* Holds the option value corresponding to this radio button item.
*
* @private
*/
_optionValue: string;
/**
* Initializes a new instance of the `PdfRadioButtonListItem` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfRadioButtonListItem` class.
*
* @param {string} value Item value.
* @param {Rectangle} bounds Item bounds.
* @param {PdfField} field Field object.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Gets the first page of the document
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Access the PDF form
* let form: PdfForm = document.form;
* // Create a new radio button list field
* let field: PdfRadioButtonListField = new PdfRadioButtonListField(page, 'Age');
* // Create and add first item
* let first: PdfRadioButtonListItem = field.add('1-9', {x: 100, y: 140, width: 20, height: 20});
* // Create and add second item
* let second: PdfRadioButtonListItem = new PdfRadioButtonListItem('10-49', {x: 100, y: 170, width: 20, height: 20}, page);
* field.add(second);
* // Create and add third item
* let third: PdfRadioButtonListItem = new PdfRadioButtonListItem('50-59', {x: 100, y: 200, width: 20, height: 20}, field);
* field.add(third);
* // Sets selected index of the radio button list field
* field.selectedIndex = 0;
* // Add the field into PDF form
* form.add(field);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
constructor(value: string, bounds: Rectangle, field: PdfField);
/**
* Initializes a new instance of the `PdfRadioButtonListItem` class.
*
* @param {string} value Item value.
* @param {Rectangle} bounds Item bounds.
* @param {PdfPage} page Page object.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Gets the first page of the document
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Access the PDF form
* let form: PdfForm = document.form;
* // Create a new radio button list field
* let field: PdfRadioButtonListField = new PdfRadioButtonListField(page, 'Age');
* // Create and add first item
* let first: PdfRadioButtonListItem = field.add('1-9', {x: 100, y: 140, width: 20, height: 20});
* // Create and add second item
* let second: PdfRadioButtonListItem = new PdfRadioButtonListItem('10-49', {x: 100, y: 170, width: 20, height: 20}, page);
* field.add(second);
* // Create and add third item
* let third: PdfRadioButtonListItem = new PdfRadioButtonListItem('50-59', {x: 100, y: 200, width: 20, height: 20}, field);
* field.add(third);
* // Sets selected index of the radio button list field
* field.selectedIndex = 0;
* // Add the field into PDF form
* form.add(field);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
constructor(value: string, bounds: Rectangle, page: PdfPage);
/**
* Parse an existing item of the field.
*
* @private
* @param {_PdfDictionary} dictionary Widget dictionary.
* @param {_PdfCrossReference} crossReference PDF cross reference.
* @param {PdfField} field Field object.
* @returns {PdfRadioButtonListItem} Widget.
*/
static _load(dictionary: _PdfDictionary, crossReference: _PdfCrossReference, field?: PdfField): PdfRadioButtonListItem;
/**
* Gets the flag to indicate whether the field item is selected or not.
*
* @returns {boolean} Selected or not.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Gets the first page of the document
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Access the PDF form
* let form: PdfForm = document.form;
* // Create a new radio button list field
* let field: PdfRadioButtonListField = new PdfRadioButtonListField(page, 'Age');
* // Access first list field item
* let item: PdfRadioButtonListItem = field.itemAt(0);
* // Gets the flag to indicate whether the field item is selected or not.
* let selected: boolean = item.selected;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
readonly selected: boolean;
/**
* Gets the value of the radio button list field item
*
* @returns {string} Value of the radio button list field item.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Gets the first page of the document
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Access the PDF form
* let form: PdfForm = document.form;
* // Create a new radio button list field
* let field: PdfRadioButtonListField = new PdfRadioButtonListField(page, 'Age');
* // Access first list field item
* let item: PdfRadioButtonListItem = field.itemAt(0);
* // Gets the value of the radio button list field item
* let value: string = item.value;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the value of the radio button list field item
*
* @param {string} option Value of the radio button list field item.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Gets the first page of the document
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Access the PDF form
* let form: PdfForm = document.form;
* // Create a new radio button list field
* let field: PdfRadioButtonListField = new PdfRadioButtonListField(page, 'Age');
* // Access first list field item
* let item: PdfRadioButtonListItem = field.itemAt(0);
* // Sets the value of the radio button list field item
* item.value = '1-9';
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
value: string;
/**
* Gets the back color of the annotation.
*
* @returns {PdfColor} Color as R, G, B color array in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfWidgetAnnotation = page.annotations.at(0) as PdfWidgetAnnotation;
* // Gets the back color of the annotation
* let backColor: PdfColor = annotation.backColor;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the back color of the annotation.
*
* @param {PdfColor} value Array with R, G, B color values in between 0 to 255.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Gets the first page of the document
* let page: PdfPage = document.getPage(0);
* // Access the PDF form
* let form: PdfForm = document.form;
* // Access the radio button list field
* let field: PdfRadioButtonListField = form.fieldAt(0) as PdfRadioButtonListField;
* // Sets the back color of the radio button list item
* field.itemAt(0).backColor = {r: 255, g: 255, b: 255};
* // Sets the background color of the field item to transparent
* field.itemAt(1).backColor = {r: 0, g: 0, b: 0, isTransparent: true};
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
backColor: PdfColor;
/**
* Initializes the radio button item with value, page, bounds, default styles, and optional parent field.
*
* @private
* @param {string} value The option/export value for this item.
* @param {any} bounds The item bounds on the page.
* @param {PdfPage} page The page where the item resides.
* @param {PdfField} [field] Optional field to register as parent.
* @returns {void} No return value.
*/
_initializeItem(value: string, bounds: {
x: number;
y: number;
width: number;
height: number;
}, page: PdfPage, field?: PdfField): void;
/**
* Updates the appearance state to the provided value or turns it off when not selected.
*
* @private
* @param {string} [value] The appearance state or index string to set as selected.
* @returns {void} No return value.
*/
_postProcess(value?: string): void;
}
/**
* `PdfListBoxItem` class represents the list and combo box field item objects.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Gets the first page of the document
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Access the PDF form
* let form: PdfForm = document.form;
* // Create a new list box field
* let field: PdfListBoxField = new PdfListBoxField(page, 'list1', {x: 100, y: 60, width: 100, height: 50});
* // Add list items to the field.
* field.addItem(new PdfListFieldItem('English', 'English'));
* field.addItem(new PdfListFieldItem('French', 'French'));
* field.addItem(new PdfListFieldItem('German', 'German'));
* // Sets the selected index
* field.selectedIndex = 2;
* // Sets the flag indicates whether the list box allows multiple selections.
* field.multiSelect = true;
* // Add the field into PDF form
* form.add(field);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfListFieldItem extends PdfStateItem {
/**
* Initializes a new instance of the `PdfListFieldItem` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfListFieldItem` class.
*
* @param {string} text The text to be displayed.
* @param {string} value The value of the item.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Gets the first page of the document
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Access the PDF form
* let form: PdfForm = document.form;
* // Create a new list box field
* let field: PdfListBoxField = new PdfListBoxField(page, 'list1', {x: 100, y: 60, width: 100, height: 50});
* // Add list items to the field.
* field.addItem(new PdfListFieldItem('English', 'English'));
* field.addItem(new PdfListFieldItem('French', 'French'));
* field.addItem(new PdfListFieldItem('German', 'German'));
* // Sets the selected index
* field.selectedIndex = 2;
* // Sets the flag indicates whether the list box allows multiple selections.
* field.multiSelect = true;
* // Add the field into PDF form
* form.add(field);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
constructor(text: string, value: string);
/**
* Initializes a new instance of the `PdfListFieldItem` class.
*
* @param {string} text The text to be displayed.
* @param {string} value The value of the item.
* @param {PdfListBoxField} field The field.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Gets the first page of the document
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Access the PDF form
* let form: PdfForm = document.form;
* // Create a new list box field
* let field: PdfListBoxField = new PdfListBoxField(page, 'list1', {x: 100, y: 60, width: 100, height: 50});
* // Create and add list items to the field.
* let item: PdfListFieldItem = new PdfListFieldItem('English', 'English', field);
* // Add list items to the field.
* field.addItem(new PdfListFieldItem('French', 'French'));
* field.addItem(new PdfListFieldItem('German', 'German'));
* // Sets the selected index
* field.selectedIndex = 2;
* // Sets the flag indicates whether the list box allows multiple selections.
* field.multiSelect = true;
* // Add the field into PDF form
* form.add(field);
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
constructor(text: string, value: string, field: PdfListBoxField);
/**
* Parse an existing item of the field.
*
* @private
* @param {_PdfDictionary} dictionary Widget dictionary.
* @param {_PdfCrossReference} crossReference PDF cross reference.
* @param {PdfField} field Field object.
* @returns {PdfListFieldItem} Widget.
*/
static _load(dictionary: _PdfDictionary, crossReference: _PdfCrossReference, field?: PdfField): PdfListFieldItem;
/**
* Gets the text of the annotation.
*
* @returns {string} Text.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Gets the first page of the document
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Access the PDF form
* let form: PdfForm = document.form;
* // Create a new radio button list field
* let field: PdfListBoxField = form.fieldAt(0) as PdfListBoxField;
* // Access first list field item
* let item: PdfListFieldItem = field.itemAt(0);
* // Gets the text of the list field item
* let text: string = item.text;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the text of the annotation.
*
* @param {string} value Text.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Gets the first page of the document
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Access the PDF form
* let form: PdfForm = document.form;
* // Create a new radio button list field
* let field: PdfListBoxField = form.fieldAt(0) as PdfListBoxField;
* // Access first list field item
* let item: PdfListFieldItem = field.itemAt(0);
* // Sets the text of the list field item
* item.text = '1-9';
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
text: string;
/**
* Gets the flag to indicate whether the field item is selected or not (Read only).
*
* @returns {boolean} Selected or not.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data);
* // Gets the first page of the document
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Access the PDF form
* let form: PdfForm = document.form;
* // Create a new radio button list field
* let field: PdfListBoxField = form.fieldAt(0) as PdfListBoxField;
* // Access first list field item
* let item: PdfListFieldItem = field.itemAt(0);
* // Gets the flag to indicate whether the field item is selected or not.
* let selected: boolean = item.selected;
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
readonly selected: boolean;
/**
* Initializes the list item with display text and value and optionally registers it with the owning list box field.
*
* @private
* @param {string} text The display text.
* @param {string} value The stored/export value.
* @param {PdfField} [field] The owning list/combobox field (registers when provided).
* @returns {void} No return value.
*/
_initializeItem(text: string, value: string, field?: PdfField): void;
}
/**
* `PdfAnnotationCaption` class represents the caption text and properties of annotations.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Create and set annotation caption values
* annotation.caption = new PdfAnnotationCaption({cap: true, type: PdfLineCaptionType.inline, offset: {x: 10, y: 10}});
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfAnnotationCaption {
/**
* Underlying dictionary that stores caption properties.
*
* @private
*/
_dictionary: _PdfDictionary;
/**
* Indicates whether the caption is enabled (C entry).
*
* @private
*/
_cap: boolean;
/**
* Defines the caption type for line annotations.
*
* @private
*/
_type: PdfLineCaptionType;
/**
* Specifies the caption offset from the line.
*
* @private
*/
_offset: Point;
/**
* Initializes a new instance of the `PdfAnnotationCaption` class.
*
* @private
*/
constructor();
/**
* Initializes a new instance of the `PdfAnnotationCaption` class.
*
* @param {object} options Caption options.
* @param {boolean} [options.cap] Boolean flag to enable or disable the caption.
* @param {PdfLineCaptionType} [options.type] Caption type.
* @param {Point} [options.offset] Caption offset position.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Create and set annotation caption values
* annotation.caption = new PdfAnnotationCaption({cap: true, type: PdfLineCaptionType.inline, offset: {x: 10, y: 10}});
* // Destroy the document
* document.destroy();
* ```
*/
constructor(options: {
cap?: boolean;
type?: PdfLineCaptionType;
offset?: Point;
});
/**
* Gets the boolean flag indicating whether annotation has caption or not.
*
* @returns {boolean} Caption.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the boolean flag indicating whether annotation has caption or not.
* let cap: boolean = annotation.caption.cap;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the boolean flag indicating whether annotation has caption or not.
*
* @param {boolean} value Caption.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the boolean flag indicating whether annotation has caption or not.
* annotation.caption.cap = true;
* // Destroy the document
* document.destroy();
* ```
*/
cap: boolean;
/**
* Gets the caption type of the annotation.
*
* @returns {PdfLineCaptionType} Caption type.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the caption type of the annotation.
* let type: PdfLineCaptionType = annotation.caption.type;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the caption type of the annotation.
*
* @param {PdfLineCaptionType} value Caption type.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the caption type of the annotation.
* annotation.caption.type = PdfLineCaptionType.inline;
* // Destroy the document
* document.destroy();
* ```
*/
type: PdfLineCaptionType;
/**
* Gets the offset position of the annotation.
*
* @returns {Point} Caption offset.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the offset position of the annotation.
* let offset: Point = annotation.caption.offset;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the offset position of the annotation.
*
* @param {Point} value Caption offset.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Sets the offset position of the annotation.
* annotation.caption.offset = {x: 10, y: 10};
* // Destroy the document
* document.destroy();
* ```
*/
offset: Point;
}
/**
* `PdfAnnotationLineEndingStyle` class represents the line ending styles of annotations.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Initializes a new instance of the `PdfAnnotationLineEndingStyle` class.
* annotation.lineEndingStyle = new PdfAnnotationLineEndingStyle({begin: PdfLineEndingStyle.openArrow, end: PdfLineEndingStyle.closeArrow});
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfAnnotationLineEndingStyle {
/**
* Underlying dictionary that stores beginning and ending styles.
*
* @private
*/
_dictionary: _PdfDictionary;
/**
* Line ending style applied at the start point.
*
* @private
*/
_begin: PdfLineEndingStyle;
/**
* Line ending style applied at the end point.
*
* @private
*/
_end: PdfLineEndingStyle;
/**
* Cross-reference used to resolve related resources.
*
* @private
*/
_crossReference: _PdfCrossReference;
/**
* Initializes a new instance of the `PdfAnnotationLineEndingStyle` class.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Initializes a new instance of the `PdfAnnotationLineEndingStyle` class.
* let lineEndingStyle = new PdfAnnotationLineEndingStyle();
* // Sets the begin line ending style of the annotation.
* lineEndingStyle.begin = PdfLineEndingStyle.openArrow;
* // Sets the end line ending style of the annotation.
* lineEndingStyle.end = PdfLineEndingStyle.closeArrow;
* // Sets the line ending style to the annotation
* annotation.lineEndingStyle = lineEndingStyle;
* // Destroy the document
* document.destroy();
* ```
*/
constructor();
/**
* Initializes a new instance of the `PdfAnnotationLineEndingStyle` class.
*
* @param {object} options Line ending style options.
* @param {PdfLineEndingStyle} [options.begin] Begin line ending style.
* @param {PdfLineEndingStyle} [options.end] End line ending style.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Initializes a new instance of the `PdfAnnotationLineEndingStyle` class.
* annotation.lineEndingStyle = new PdfAnnotationLineEndingStyle({
* begin: PdfLineEndingStyle.openArrow,
* end: PdfLineEndingStyle.closeArrow
* });
* // Destroy the document
* document.destroy();
* ```
*/
constructor(options: {
begin?: PdfLineEndingStyle;
end?: PdfLineEndingStyle;
});
/**
* Gets the begin line ending style of the annotation.
*
* @returns {PdfLineEndingStyle} Begin line ending style.
* `PdfAnnotationLineEndingStyle` class represents the line ending styles of annotations.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the begin line ending style of the annotation.
* let begin: PdfLineEndingStyle = annotation.lineEndingStyle.begin;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the begin line ending style of the annotation.
*
* @param {PdfLineEndingStyle} value Begin line ending style.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Initializes a new instance of the `PdfAnnotationLineEndingStyle` class.
* let lineEndingStyle = new PdfAnnotationLineEndingStyle();
* // Sets the begin line ending style of the annotation.
* lineEndingStyle.begin = PdfLineEndingStyle.openArrow;
* // Sets the end line ending style of the annotation.
* lineEndingStyle.end = PdfLineEndingStyle.closeArrow;
* // Sets the line ending style to the annotation
* annotation.lineEndingStyle = lineEndingStyle;
* // Destroy the document
* document.destroy();
* ```
*/
begin: PdfLineEndingStyle;
/**
* Gets the begin line ending style of the annotation.
*
* @returns {PdfLineEndingStyle} End line ending style.
* `PdfAnnotationLineEndingStyle` class represents the line ending styles of annotations.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the end line ending style of the annotation.
* let end: PdfLineEndingStyle = annotation.lineEndingStyle.end;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the begin line ending style of the annotation.
*
* @param {PdfLineEndingStyle} value End line ending style.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Initializes a new instance of the `PdfAnnotationLineEndingStyle` class.
* let lineEndingStyle = new PdfAnnotationLineEndingStyle();
* // Sets the begin line ending style of the annotation.
* lineEndingStyle.begin = PdfLineEndingStyle.openArrow;
* // Sets the end line ending style of the annotation.
* lineEndingStyle.end = PdfLineEndingStyle.closeArrow;
* // Sets the line ending style to the annotation
* annotation.lineEndingStyle = lineEndingStyle;
* // Destroy the document
* document.destroy();
* ```
*/
end: PdfLineEndingStyle;
}
/**
* `PdfInteractiveBorder` class represents the border of the field.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the PDF form field
* let field: PdfField = document.form.fieldAt(0);
* // Gets the width of the field border.
* let width: number = field.border.width;
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfInteractiveBorder {
/**
* Underlying dictionary that defines border attributes.
*
* @private
*/
_dictionary: _PdfDictionary;
/**
* Width of the interactive border.
*
* @private
*/
_width: number;
/**
* Style of the border.
*
* @private
*/
_style: PdfBorderStyle;
/**
* Dash pattern used when the border style is dashed.
*
* @private
*/
_dash: Array<number>;
/**
* Cross-reference used for serialization of the border.
*
* @private
*/
_crossReference: _PdfCrossReference;
/**
* Initializes a new instance of the `PdfInteractiveBorder` class.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the PDF form field
* let field: PdfField = document.form.fieldAt(0);
* // Initializes a new instance of the `PdfInteractiveBorder` class.
* let border: PdfInteractiveBorder = new PdfInteractiveBorder();
* //Sets the width of the annotation border.
* border.width = 10;
* //Sets the style of the annotation border.
* border.style = PdfBorderStyle.dashed;
* //Sets the dash pattern of the annotation border.
* border.dash = [1, 2, 1];
* // Sets the border to the PDF form field
* field.border = border;
* // Destroy the document
* document.destroy();
* ```
*/
constructor();
/**
* Initializes a new instance of the `PdfInteractiveBorder` class.
*
* @param {object} options interactive option.
* @param {number} [options.width] Border width.
* @param {PdfBorderStyle} [options.style] Border style.
* @param {Array<number>} [options.dash] Dash pattern.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the PDF form field
* let field: PdfField = document.form.fieldAt(0);
* // Initializes a new instance of the `PdfInteractiveBorder` class.
* field.border = new PdfInteractiveBorder({width: 2, style: PdfBorderStyle.solid, dash: [1, 1]});
* // Destroy the document
* document.destroy();
* ```
*/
constructor(options: {
width?: number;
style?: PdfBorderStyle;
dash?: Array<number>;
});
/**
* Gets the width of the field border.
*
* @returns {number} border width.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the PDF form field
* let field: PdfField = document.form.fieldAt(0);
* // Gets the width of the annotation border.
* let width: number = field.border.width;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the width of the field border.
*
* @param {number} value width.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the PDF form field
* let field: PdfField = document.form.fieldAt(0);
* // Initializes a new instance of the `PdfInteractiveBorder` class.
* let border: PdfInteractiveBorder = new PdfInteractiveBorder();
* //Sets the width of the annotation border.
* border.width = 10;
* //Sets the style of the annotation border.
* border.style = PdfBorderStyle.dashed;
* //Sets the dash pattern of the annotation border.
* border.dash = [1, 2, 1];
* // Sets the border to the PDF form field
* field.border = border;
* // Destroy the document
* document.destroy();
* ```
*/
width: number;
/**
* Gets the border line style of the field border.
*
* @returns {PdfBorderStyle} Border style.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the PDF form field
* let field: PdfField = document.form.fieldAt(0);
* // Gets the border line style of the annotation border.
* let style: PdfBorderStyle = field.border.style;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the border line style of the field border.
*
* @param {PdfBorderStyle} value Border style.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the PDF form field
* let field: PdfField = document.form.fieldAt(0);
* // Initializes a new instance of the `PdfInteractiveBorder` class.
* let border: PdfInteractiveBorder = new PdfInteractiveBorder();
* //Sets the width of the annotation border.
* border.width = 10;
* //Sets the style of the annotation border.
* border.style = PdfBorderStyle.dashed;
* //Sets the dash pattern of the annotation border.
* border.dash = [1, 2, 1];
* // Sets the border to the PDF form field
* field.border = border;
* // Destroy the document
* document.destroy();
* ```
*/
style: PdfBorderStyle;
/**
* Gets the dash pattern of the field border.
*
* @returns {Array<number>} Dash pattern.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the PDF form field
* let field: PdfField = document.form.fieldAt(0);
* // Gets the dash pattern of the field border.
* let dash: Array<number>= field.border.dash;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the dash pattern of the field border.
*
* @param {Array<number>} value Dash pattern.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the PDF form field
* let field: PdfField = document.form.fieldAt(0);
* // Initializes a new instance of the `PdfInteractiveBorder` class.
* let border: PdfInteractiveBorder = new PdfInteractiveBorder();
* //Sets the width of the annotation border.
* border.width = 10;
* //Sets the style of the annotation border.
* border.style = PdfBorderStyle.dashed;
* //Sets the dash pattern of the annotation border.
* border.dash = [1, 2, 1];
* // Sets the border to the PDF form field
* field.border = border;
* // Destroy the document
* document.destroy();
* ```
*/
dash: Array<number>;
}
/**
* `PdfAnnotationBorder` class represents the border properties of annotations.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Initializes a new instance of the `PdfAnnotationBorder` class.
* let border: PdfAnnotationBorder = new PdfAnnotationBorder();
* //Sets the width of the annotation border.
* border.width = 10;
* //Sets the style of the annotation border.
* border.style = PdfBorderStyle.dashed;
* //Sets the dash pattern of the annotation border.
* border.dash = [1, 2, 1];
* // Sets the border to the PDF form field
* annotation.border = border;
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfAnnotationBorder extends PdfInteractiveBorder {
/**
* Horizontal corner radius for rounded rectangles.
*
* @private
*/
_hRadius: number;
/**
* Vertical corner radius for rounded rectangles.
*
* @private
*/
_vRadius: number;
/**
* Initializes a new instance of the `PdfAnnotationBorder` class.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Initializes a new instance of the `PdfAnnotationBorder` class.
* let border: PdfAnnotationBorder = new PdfAnnotationBorder();
* //Sets the width of the annotation border.
* border.width = 10;
* //Sets the style of the annotation border.
* border.style = PdfBorderStyle.dashed;
* //Sets the dash pattern of the annotation border.
* border.dash = [1, 2, 1];
* // Sets the border to the PDF form field
* annotation.border = border;
* // Destroy the document
* document.destroy();
* ```
*/
constructor();
/**
* Initializes a new instance of the `PdfAnnotationBorder` class.
*
* @param {object} options Annotation border options.
* @param {number} [options.width] Border width.
* @param {number} [options.hRadius] Border horizontal corner radius.
* @param {number} [options.vRadius] Border vertical corner radius.
* @param {PdfBorderStyle} [options.style] Border style.
* @param {number[]} [options.dash] Dash pattern.
*
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Initializes a new instance of the `PdfAnnotationBorder` class and sets it into the PDF annotation.
* annotation.border = new PdfAnnotationBorder({
* width: 2,
* hRadius: 10,
* vRadius: 20,
* style: PdfBorderStyle.solid,
* dash: [1, 1]
* });
* // Destroy the document
* document.destroy();
* ```
*/
constructor(options: {
width?: number;
hRadius?: number;
vRadius?: number;
style?: PdfBorderStyle;
dash?: Array<number>;
});
/**
* Gets the width of the annotation border.
*
* @returns {number} border width.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the width of the annotation border.
* let width: number = annotation.border.width;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the width of the annotation border.
*
* @param {number} value width.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Initializes a new instance of the ` PdfAnnotationBorder ` class.
* let border: PdfAnnotationBorder = new PdfAnnotationBorder ();
* //Sets the width of the annotation border.
* border.width = 10;
* //Sets the style of the annotation border.
* border.style = PdfBorderStyle.dashed;
* //Sets the dash pattern of the annotation border.
* border.dash = [1, 2, 1];
* // Sets the border to the PDF form field
* annotation.border = border;
* // Destroy the document
* document.destroy();
* ```
*/
width: number;
/**
* Gets the horizontal radius of the annotation border.
*
* @returns {number} horizontal radius.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the horizontal radius of the annotation border.
* let hRadius: number = annotation.border.hRadius;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the horizontal radius of the annotation border.
*
* @param {number} value horizontal radius.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Initializes a new instance of the `PdfAnnotationBorder` class.
* let border: PdfAnnotationBorder = new PdfAnnotationBorder();
* //Sets the width of the annotation border.
* border.width = 10;
* // Sets the horizontal radius of the annotation border.
* border.hRadius = 2;
* //Sets the style of the annotation border.
* border.style = PdfBorderStyle.dashed;
* //Sets the dash pattern of the annotation border.
* border.dash = [1, 2, 1];
* // Sets the border to the PDF form field
* annotation.border = border;
* // Destroy the document
* document.destroy();
* ```
*/
hRadius: number;
/**
* Gets the vertical radius of the annotation border.
*
* @returns {number} vertical radius.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Gets the vertical radius of the annotation border.
* let vRadius: number = annotation.border.vRadius;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the vertical radius of the annotation border.
*
* @param {number} value vertical radius.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfLineAnnotation = page.annotations.at(0) as PdfLineAnnotation;
* // Initializes a new instance of the `PdfAnnotationBorder` class.
* let border: PdfAnnotationBorder = new PdfAnnotationBorder();
* //Sets the width of the annotation border.
* border.width = 10;
* // Sets the vertical radius of the annotation border.
* border.vRadius = 2;
* //Sets the style of the annotation border.
* border.style = PdfBorderStyle.dashed;
* //Sets the dash pattern of the annotation border.
* border.dash = [1, 2, 1];
* // Sets the border to the PDF form field
* annotation.border = border;
* // Destroy the document
* document.destroy();
* ```
*/
vRadius: number;
}
/**
* `PdfBorderEffect` class represents the border effects of annotations.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfSquareAnnotation = page.annotations.at(0) as PdfSquareAnnotation;
* // Initializes a new instance of the `PdfBorderEffect` class.
* let borderEffect: PdfBorderEffect = new PdfBorderEffect();
* // Sets the intensity of the annotation border.
* borderEffect.intensity = 2;
* // Sets the effect style of the annotation border.
* borderEffect.style = PdfBorderEffectStyle.cloudy;
* // Sets border effect to the annotation.
* annotation.borderEffect = borderEffect;
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfBorderEffect {
/**
* Underlying dictionary that defines border effect attributes.
*
* @private
*/
_dictionary: _PdfDictionary;
/**
* Cloudiness or intensity value for the border effect.
*
* @private
*/
_intensity: number;
/**
* Type of border effect applied (e.g., cloudy).
*
* @private
*/
_style: PdfBorderEffectStyle;
/**
* Cross-reference used to serialize the border effect.
*
* @private
*/
_crossReference: _PdfCrossReference;
/**
* Initializes a new instance of the `PdfBorderEffect` class.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfSquareAnnotation = page.annotations.at(0) as PdfSquareAnnotation;
* // Initializes a new instance of the `PdfBorderEffect` class.
* let borderEffect: PdfBorderEffect = new PdfBorderEffect();
* // Sets the intensity of the annotation border.
* borderEffect.intensity = 2;
* // Sets the effect style of the annotation border.
* borderEffect.style = PdfBorderEffectStyle.cloudy;
* // Sets border effect to the annotation.
* annotation.borderEffect = borderEffect;
* // Destroy the document
* document.destroy();
* ```
*/
constructor();
/**
* Initializes a new instance of the `PdfBorderEffect` class.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfSquareAnnotation = page.annotations.at(0) as PdfSquareAnnotation;
* // Initializes a new instance of the `PdfBorderEffect` class.
* let borderEffect: PdfBorderEffect = new PdfBorderEffect({intensity: 2, style: PdfBorderEffectStyle.cloudy});
* // Sets border effect to the annotation.
* annotation.borderEffect = borderEffect;
* // Destroy the document
* document.destroy();
* ```
*/
constructor(options: {
intensity?: number;
style?: PdfBorderEffectStyle;
});
/**
* Initializes a new instance of the `PdfBorderEffect` class.
*
* @private
* @param {_PdfDictionary} dictionary Border effect dictionary.
*/
constructor(dictionary: _PdfDictionary);
/**
* Gets the intensity of the annotation border.
*
* @returns {number} intensity.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfSquareAnnotation = page.annotations.at(0) as PdfSquareAnnotation;
* // Gets the intensity of the annotation border.
* let intensity: number = annotation.borderEffect.intensity;
* // Gets the effect style of the annotation border.
* let style: PdfBorderEffectStyle = annotation.borderEffect.style;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the intensity of the annotation border.
*
* @param {number} value intensity.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfSquareAnnotation = page.annotations.at(0) as PdfSquareAnnotation;
* // Initializes a new instance of the `PdfBorderEffect` class.
* let borderEffect: PdfBorderEffect = new PdfBorderEffect();
* // Sets the intensity of the annotation border.
* borderEffect.intensity = 2;
* // Sets the effect style of the annotation border.
* borderEffect.style = PdfBorderEffectStyle.cloudy;
* // Sets border effect to the annotation.
* annotation.borderEffect = borderEffect;
* // Destroy the document
* document.destroy();
* ```
*/
intensity: number;
/**
* Gets the effect style of the annotation border.
*
* @returns {PdfBorderEffectStyle} effect style.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfSquareAnnotation = page.annotations.at(0) as PdfSquareAnnotation;
* // Gets the intensity of the annotation border.
* let intensity: number = annotation.borderEffect.intensity;
* // Gets the effect style of the annotation border.
* let style: PdfBorderEffectStyle = annotation.borderEffect.style;
* // Destroy the document
* document.destroy();
* ```
*/
/**
* Sets the effect style of the annotation border.
*
* @param {PdfBorderEffectStyle} value effect style.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Get the first page
* let page: PdfPage = document.getPage(0) as PdfPage;
* // Get the first annotation of the page
* let annotation: PdfSquareAnnotation = page.annotations.at(0) as PdfSquareAnnotation;
* // Initializes a new instance of the `PdfBorderEffect` class.
* let borderEffect: PdfBorderEffect = new PdfBorderEffect();
* // Sets the intensity of the annotation border.
* borderEffect.intensity = 2;
* // Sets the effect style of the annotation border.
* borderEffect.style = PdfBorderEffectStyle.cloudy;
* // Sets border effect to the annotation.
* annotation.borderEffect = borderEffect;
* // Destroy the document
* document.destroy();
* ```
*/
style: PdfBorderEffectStyle;
/**
* Converts the border effect name into the corresponding border effect style.
*
* @private
* @param {string} value The raw border effect string (e.g., '/C' or other values).
* @returns {PdfBorderEffectStyle} The mapped border effect style.
*/
_getBorderEffect(value: string): PdfBorderEffectStyle;
/**
* Converts the border effect style into its corresponding string representation.
*
* @private
* @param {PdfBorderEffectStyle} value The border effect style to convert.
* @returns {string} The string representation for use in the annotation dictionary.
*/
_styleToEffect(value: PdfBorderEffectStyle): string;
}
/**
* Holds rendering parameters used for painting annotation appearances.
*
* @private
*/
export declare class _PaintParameter {
borderPen: PdfPen;
backBrush: PdfBrush;
foreBrush: PdfBrush;
shadowBrush: PdfBrush;
borderWidth: number;
bounds: Rectangle;
borderStyle: PdfBorderStyle;
rotationAngle: number;
pageRotationAngle: PdfRotationAngle;
insertSpaces: boolean;
required: boolean;
isAutoFontSize: boolean;
stringFormat: PdfStringFormat;
constructor();
}