UNPKG

@syncfusion/ej2-pdf

Version:

Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.

1,431 lines 50.6 kB
import { _PdfDictionary, _PdfName, _PdfReference } from './pdf-primitives';
import { PdfPage } from './pdf-page';
import { PdfFormFieldVisibility, PdfAnnotationFlag, PdfCheckBoxStyle, PdfHighlightMode, PdfBorderStyle, PdfBorderEffectStyle, PdfLineEndingStyle, _PdfCheckFieldState, PdfMeasurementUnit, _PdfGraphicsUnit, PdfTextMarkupAnnotationType, PdfAnnotationState, PdfAnnotationStateModel, PdfPopupIcon, PdfRubberStampAnnotationIcon, PdfAttachmentIcon, PdfAnnotationIntent, PdfBlendMode, PdfNumberStyle } from './enumerator';
import { PdfDocument, PdfPageSettings } from './pdf-document';
import { _PdfBaseStream } from './base-stream';
import { PdfStateItem, PdfComment, PdfWidgetAnnotation, PdfAnnotation, PdfInteractiveBorder, _PaintParameter, PdfRubberStampAnnotation } from './annotations/annotation';
import { PdfPopupAnnotationCollection } from './annotations/annotation-collection';
import { PdfTemplate } from './graphics/pdf-template';
import { PdfField } from './form/field';
import { PdfCjkFontFamily, PdfFont, PdfFontFamily, PdfFontStyle, PdfStandardFont } from './fonts/pdf-standard-font';
import { _PdfCrossReference } from './pdf-cross-reference';
import { PdfForm } from './form/form';
import { _ImageDecoder } from './graphics/images/image-decoder';
import { _PdfFontMetrics } from './fonts/pdf-font-metrics';
import { _PdfUniqueEncodingElement } from './security/digital-signature/asn1/unique-encoding-element';
import { PdfColor, Point } from './pdf-type';
/**
 * Gets the unsigned value.
 *
 * @private
 * @param {number} value input value.
 * @param {number} bits bits to process.
 * @returns {number} unsigned value.
 */
export declare function _toUnsigned(value: number, bits: number): number;
/**
 * Gets the signed 16 bit value.
 *
 * @private
 * @param {number} value input value.
 * @returns {number} unsigned value.
 */
export declare function _toSigned16(value: number): number;
/**
 * Copy values from one array to another.
 *
 * @private
 * @param {number[]} target destination array.
 * @param {number} at target index.
 * @param {number[]} source source array.
 * @param {number} start start index.
 * @param {number} end end index.
 * @returns {void} Returns nothing.
 */
export declare function _copyRange(target: number[], at: number, source: number[], start?: number, end?: number): void;
/**
 * Checks the type of the image using header bytes.
 *
 * @private
 * @param {Uint8Array} imageData image data.
 * @param {number[]} header header bytes.
 * @returns {boolean} Header matched or not.
 */
export declare function _checkType(imageData: Uint8Array, header: number[]): boolean;
/**
 * Gets the image decoder.
 *
 * @private
 * @param {Uint8Array} imageData image data.
 * @returns {_ImageDecoder} Image decoder.
 */
export declare function _getDecoder(imageData: Uint8Array): _ImageDecoder;
/**
 * Gets the page rotation.
 *
 * @private
 * @param {PdfPage} page Page.
 * @param {number} height Height.
 * @param {number} left Left.
 * @returns {number} Page rotation.
 */
export declare function _checkRotation(page: PdfPage, height: number, left: number): number;
/**
 * Gets the page index.
 *
 * @private
 * @param {PdfDocument} loadedDocument Loaded document.
 * @param {_PdfDictionary} pageDictionary Page dictionary.
 * @returns {number} Page index.
 */
export declare function _getPageIndex(loadedDocument: PdfDocument, pageDictionary: _PdfDictionary): number;
/**
 * Convert string value from annotation flag
 *
 * @private
 * @param {PdfAnnotationFlag} flag Annotation flag.
 * @returns {string} Valid string to write into XML.
 */
export declare function _annotationFlagsToString(flag: PdfAnnotationFlag): string;
/**
 * Convert string value to annotation flag
 *
 * @private
 * @param {string} flag String value to map
 * @returns {PdfAnnotationFlag} Annotation flag
 */
export declare function _stringToAnnotationFlags(flag: string): PdfAnnotationFlag;
/**
 * Convert string value to byte array
 *
 * @private
 * @param {string} value string value.
 * @returns {string} Valid string to write into PDF.
 */
export declare function _stringToPdfString(value: string): string;
/**
 * Convert string value to byte array
 *
 * @private
 * @param {string} value string value.
 * @param {boolean} isDirect Whether to return a number[] or Uint8Array.
 * @param {boolean} isPassword Whether the string is a password.
 * @param {number[]} destination Destination array.
 * @returns {number[] | Uint8Array} Byte array
 */
export declare function _stringToBytes(value: string, isDirect?: boolean, isPassword?: boolean, destination?: number[]): number[] | Uint8Array;
/**
 * Check equal or not.
 *
 * @private
 * @param {Uint8Array | number[]} first byte array.
 * @param {Uint8Array | number[]} second byte array.
 * @returns {boolean} Equal or not
 */
export declare function _areArrayEqual(first: Uint8Array | number[], second: Uint8Array | number[]): boolean;
/**
 * Check whether entries in points are equal or not.
 *
 * @private
 * @param {Point[]} a first point array.
 * @param {Point[]} b second point array.
 * @returns {boolean} Return true if for each elements are equal in both point array.
 */
export declare function _arePointsEqual(a: Point[], b: Point[]): boolean;
/**
 * Convert number to string as round value with fixed decimal points 2.
 *
 * @private
 * @param {number} value number value.
 * @returns {boolean} Equal string.
 */
export declare function _numberToString(value: number): string;
/**
 * Check whether entries in two array are equal or not.
 *
 * @private
 * @param {number[]} value first array.
 * @param {number[]} current second array.
 * @returns {boolean} Return true if for each elements are equal in both array.
 */
export declare function _areNotEqual(value: number[], current: number[]): boolean;
/**
 * Check whether entries in points are equal or not.
 *
 * @private
 * @param {Point[]} value first point array.
 * @param {Point[]} current second point array.
 * @returns {boolean} Return true if for each elements are equal in both point array.
 */
export declare function _arePointsNotEqual(value: Point[], current: Point[]): boolean;
/**
 * Process bytes and convert as string.
 *
 * @private
 * @param {Uint8Array} bytes Input data.
 * @param {boolean} isJson Whether is json or xfdf.
 * @returns {string} String value processed from input bytes.
 */
export declare function _bytesToString(bytes: Uint8Array, isJson?: boolean): string;
/**
 * Decodes encoded name values by converting hexadecimal Unicode escape sequences into corresponding characters.
 *
 * @private
 * @param {string} name Encoded name string.
 * @returns {string} Decoded string.
 */
export declare function _decodeName(name: string): string;
/**
 * Decode unicode string.
 *
 * @private
 * @param {Uint8Array} bytes Input data.
 * @returns {string} String value processed from input bytes.
 */
export declare function _decodeUnicodeBytes(bytes: Uint8Array): string;
/**
 * Convert string to unicode array.
 *
 * @private
 * @param {string} value string value.
 * @returns {Uint8Array} unicode array
 */
export declare function _stringToUnicodeArray(value: string): Uint8Array;
/**
 * Convert byte array to hex string.
 *
 * @private
 * @param {Uint8Array} byteArray Byte array.
 * @returns {string} Hex string.
 */
export declare function _byteArrayToHexString(byteArray: Uint8Array): string;
/**
 * Convert hex string to byte array.
 *
 * @private
 * @param {string} hexString Hex string.
 * @param {boolean} isDirect Whether to return object or number[]. Default is false.
 * @returns {Uint8Array | number[]} Byte array.
 */
export declare function _hexStringToByteArray(hexString: string, isDirect?: boolean): Uint8Array | number[];
/**
 * Convert hex string to normal string.
 *
 * @private
 * @param {string} hexString Hex string.
 * @returns {string} Normal string.
 */
export declare function _hexStringToString(hexString: string): string;
/**
 * Check whether the character code is white space.
 *
 * @private
 * @param {number} ch The character code to check.
 * @returns {boolean} True if the character is space, otherwise false.
 */
export declare function _isWhiteSpace(ch: number): boolean;
/**
 * Decode bytes from base64 string.
 *
 * @private
 * @param {string} input The base64 string to decode.
 * @param {boolean} isDirect Whether to return object or number[]. Default is false.
 * @returns {Uint8Array | number[]} Decoded bytes.
 */
export declare function _decode(input: string, isDirect?: boolean): Uint8Array | number[];
/**
 * Encode bytes to base64 string.
 *
 * @private
 * @param {Uint8Array} bytes Bytes to encode.
 * @returns {string} Decoded string.
 */
export declare function _encode(bytes: Uint8Array): string;
/**
 * Get property value in inheritable mode.
 *
 * @private
 * @param {_PdfDictionary} dictionary Input dictionary.
 * @param {string} key Input dictionary.
 * @param {boolean} isArray Search array.
 * @param {boolean} stopWhenFound Stop when found.
 * @param {string[]} parentKey Key string for parent node.
 * @returns {any} Property value.
 */
export declare function _getInheritableProperty(dictionary: _PdfDictionary, key: string, isArray?: boolean, stopWhenFound?: boolean, ...parentKey: string[]): any;
/**
 * Calculate bounds of annotation or field.
 *
 * @private
 * @param {_PdfDictionary} dictionary Input dictionary.
 * @param {boolean} isWidget Input page.
 * @returns {any} Bounds value.
 */
export declare function _parseRectangle(dictionary: _PdfDictionary, isWidget?: boolean): {
    x: number;
    y: number;
    width: number;
    height: number;
};
/**
 * Calculate bounds of annotation or field.
 *
 * @private
 * @param {_PdfDictionary} dictionary Input dictionary.
 * @param {string} page Input page.
 * @returns {any} Bounds value.
 */
export declare function _calculateBounds(dictionary: _PdfDictionary, page: PdfPage): {
    x: number;
    y: number;
    width: number;
    height: number;
};
/**
 * Calculate bounds of annotation or field.
 *
 * @private
 * @param {number[]} value array value.
 * @returns {any} Rectangle value.
 */
export declare function _toRectangle(value: number[]): {
    x: number;
    y: number;
    width: number;
    height: number;
};
/**
 * Calculate bounds of annotation or field.
 *
 * @private
 * @param {any} value Rectangle value.
 * @param {any} value.x X value.
 * @param {any} value.y Y value.
 * @param {any} value.width Width value.
 * @param {any} value.height Height value.
 * @returns {number[]} Bounds value.
 */
export declare function _fromRectangle(value: {
    x: number;
    y: number;
    width: number;
    height: number;
}): number[];
/**
 * Calculate bounds of annotation or field.
 *
 * @private
 * @param {number[]} value Input dictionary.
 * @param {string} page Input page.
 * @returns {number[]} Bounds value.
 */
export declare function _getUpdatedBounds(value: number[], page?: PdfPage): number[];
/**
 * Parse RGB color.
 *
 * @private
 * @param {string} colorString Color value in string format.
 * @returns {PdfColor | undefined} RGB color value.
 */
export declare function _convertToColor(colorString: string): PdfColor | undefined;
/**
 * Checks if the given value is an array of Point objects.
 *
 * @private
 * @param {any} value - Value to check.
 * @returns {boolean} True if value is Point[].
 */
export declare function _isPointArray(value: any): boolean;
/**
 * Converts a flat number array into an array of Point objects.
 *
 * @private
 * @param {number[]} arr - Array of numbers [x1, y1, x2, y2, ...].
 * @returns {Point[]} Array of Point objects.
 */
export declare function _convertToPoints(arr: number[]): Point[];
/**
 * Converts a number array into an array of Point arrays.
 *
 * @private
 * @param {Array<number[]>} data - Array of arrays containing numeric coordinates.
 * @returns {Array<Point[]>} Array of Point arrays.
 */
export declare function _convertNumberToPointArrays(data: Array<number[]>): Array<Point[]>;
/**
 * Converts a number array into a flat array of Point objects.
 *
 * @private
 * @param {Array<number[]>} data - Array of arrays containing numeric coordinates.
 * @returns {Point[]} Flattened array of Point objects.
 */
export declare function _convertNumberArraysToPoints(data: Array<number[]>): Point[];
/**
 * Converts an array of Point arrays into a number array.
 *
 * @private
 * @param {Array<Point[]>} data - Array of Point arrays.
 * @returns {Array<number[]>} Array of arrays containing numeric coordinates.
 */
export declare function _convertPointsToNumberArrays(data: Array<Point[]>): Array<number[]>;
/**
 * Converts an array of Point objects into a flat number array.
 *
 * @private
 * @param {Point[]} data - Array of Point objects.
 * @returns {number[]} Array of numbers [x1, y1, x2, y2, ...].
 */
export declare function _convertPointToNumberArray(data: Point[]): number[];
/**
 * Parse RGB color.
 *
 * @private
 * @param {number[]} array Color array in dictionary.
 * @returns {PdfColor} RGB color value.
 */
export declare function _parseColor(array: number[]): PdfColor;
/**
 * Get the border style in _PdfName.
 *
 * @private
 * @param {PdfBorderStyle} style border style in enum.
 * @returns {_PdfName} border style in _PdfName.
 */
export declare function _mapBorderStyle(style: PdfBorderStyle): _PdfName;
/**
 * Get the border effect style in _PdfName.
 *
 * @private
 * @param {string} style border effect style as string.
 * @returns {PdfBorderEffectStyle} border effect style.
 */
export declare function _mapBorderEffectStyle(style: string): PdfBorderEffectStyle;
/**
 * Get the string value for line ending style.
 *
 * @private
 * @param {PdfLineEndingStyle} style style in enum.
 * @returns {string} value default None.
 */
export declare function _reverseMapEndingStyle(style: PdfLineEndingStyle): string;
/**
 * Get the enum value for line ending style.
 *
 * @private
 * @param {string} style Style value in string.
 * @param {PdfLineEndingStyle} defaultValue Default style value to return.
 * @returns {PdfLineEndingStyle} enum value default 0.
 */
export declare function _mapLineEndingStyle(style: string, defaultValue?: PdfLineEndingStyle): PdfLineEndingStyle;
/**
 * Get highlight mode.
 *
 * @private
 * @param {string} mode Mode entry in dictionary.
 * @returns {PdfHighlightMode} Highlight mode.
 */
export declare function _mapHighlightMode(mode: string): PdfHighlightMode;
/**
 * Get highlight mode as string.
 *
 * @private
 * @param {PdfHighlightMode} mode Mode entry.
 * @returns {_PdfName} Highlight mode as PDF name.
 */
export declare function _reverseMapHighlightMode(mode: PdfHighlightMode): _PdfName;
/**
 * Reverse map blend mode.
 *
 * @private
 * @param {PdfBlendMode} mode Mode entry.
 * @returns {_PdfName} Blend mode as name.
 */
export declare function _reverseMapBlendMode(mode: PdfBlendMode): _PdfName;
/**
 * Map blend mode.
 *
 * @private
 * @param {_PdfName} token Blend mode as name.
 * @returns {PdfBlendMode} Mode value;
 */
export declare function _mapBlendMode(token: _PdfName): PdfBlendMode;
/**
 * Convert float to string.
 *
 * @private
 * @param {number} value number value.
 * @returns {string} equal fixed length string value;
 */
export declare function _floatToString(value: number): string;
/**
 * Check and add proc set value.
 *
 * @private
 * @param {string} value entry.
 * @param {_PdfDictionary} dictionary source dictionary.
 * @returns {void} Nothing;
 */
export declare function _addProcSet(value: string, dictionary: _PdfDictionary): void;
/**
 * Get new GUID string.
 *
 * @private
 * @returns {string} A new GUID string;
 */
export declare function _getNewGuidString(): string;
/**
 * Escape PDF name.
 *
 * @private
 * @param {string} value name value.
 * @returns {string} equal and processed name value;
 */
export declare function _escapePdfName(value: string): string;
/**
 * Encodes a single Unicode code point (U+0000 to U+10FFFF) into UTF-8 bytes.
 *
 * @param {number} codePoint - The Unicode code point to encode.
 * @returns {number[]} An array of UTF-8 byte values (0 to 255).
 */
export declare function _encodeCodePointToUtf8(codePoint: number): number[];
/**
 * Converts a number to a two-character uppercase hexadecimal string.
 *
 * @param {number} n - The number to convert (0 to 255 recommended).
 * @returns {string} A two-character uppercase hexadecimal string.
 */
export declare function _toHex2(n: number): string;
/**
 * Checks whether a given character is a valid hexadecimal digit.
 *
 * @param {string} ch - The character to check.
 * @returns {boolean} True if the character is a hex digit; otherwise, false.
 */
export declare function _isHexDigit(ch: string): boolean;
/**
 * Calculate bezier arc points.
 *
 * @private
 * @param {number} x1 value.
 * @param {number} y1 value.
 * @param {number} x2 value.
 * @param {number} y2 value.
 * @param {number} start value.
 * @param {number} extent value.
 * @returns {number[]} bezier arc points;
 */
export declare function _getBezierArc(x1: number, y1: number, x2: number, y2: number, start: number, extent: number): number[];
/**
 * Find page of the annotation.
 *
 * @private
 * @param {PdfDocument} document PDF document.
 * @param {_PdfReference} reference Annotation reference.
 * @returns {PdfPage} Page of the annotation;
 */
export declare function _findPage(document: PdfDocument, reference: _PdfReference): PdfPage;
/**
 * Check the field is checked or not.
 *
 * @private
 * @param {_PdfDictionary} dictionary PDF dictionary.
 * @returns {boolean} True if the field is checked, otherwise false;
 */
export declare function _checkField(dictionary: _PdfDictionary): boolean;
/**
 * Get item value from state item field.
 *
 * @private
 * @param {_PdfDictionary} itemDictionary PDF document.
 * @returns {string} value of item;
 */
export declare function _getItemValue(itemDictionary: _PdfDictionary): string;
/**
 * Get state item template.
 *
 * @private
 * @param {_PdfCheckFieldState} state Check field state.
 * @param {PdfStateItem | PdfField} item source to check.
 * @returns {PdfTemplate} Appearance template;
 */
export declare function _getStateTemplate(state: _PdfCheckFieldState, item: PdfStateItem | PdfField): PdfTemplate;
/**
 * Get color value
 *
 * @private
 * @param {string} colorName name of the color.
 * @returns {number[]} return color value as number array.
 */
export declare function _getColorValue(colorName: string): number[];
/**
 * Update box value in template bounds.
 *
 * @private
 * @param {PdfTemplate} template Template object.
 * @param {number} angle Angle value.
 * @param {PdfAnnotation} annotation annotation instance.
 * @returns {void} Nothing.
 */
export declare function _setMatrix(template: PdfTemplate, angle?: number, annotation?: PdfAnnotation): void;
/**
 * Computes the center X-coordinate after transforming the bounding box by a rotation matrix.
 *
 * @private
 * @param {number} angle The rotation angle in degrees.
 * @param {number[]} bbox The bounding box represented as an array of four numbers [x, y, width, height].
 * @param {number} x The original center X-coordinate.
 * @param {PdfRubberStampAnnotation} annotation The annotation to be transformed.
 * @returns {number} The transformed center X-coordinate.
 */
export declare function _getCenterX(angle: number, bbox: number[], x: number, annotation: PdfRubberStampAnnotation): number;
/**
 * Computes the center Y-coordinate after transforming the bounding box by a rotation matrix.
 *
 * @private
 * @param {number} angle The rotation angle in degrees.
 * @param {number[]} bbox The bounding box represented as an array of four numbers [x, y, width, height].
 * @param {number} y The original center Y-coordinate.
 * @param {PdfRubberStampAnnotation} annotation The annotation to be transformed.
 * @returns {number} The transformed center Y-coordinate.
 */
export declare function _getCenterY(angle: number, bbox: number[], y: number, annotation: PdfRubberStampAnnotation): number;
/**
 * Get the state item style to string
 *
 * @private
 * @param {PdfCheckBoxStyle} style State item style.
 * @returns {string} return as string value.
 */
export declare function _styleToString(style: PdfCheckBoxStyle): string;
/**
 * Get the string to state item style
 *
 * @private
 * @param {string} style State item style as string.
 * @returns {PdfCheckBoxStyle} return as state item style.
 */
export declare function _stringToStyle(style: string): PdfCheckBoxStyle;
/**
 * Map measurement unit type.
 *
 * @private
 * @param {string} unitString measurement unit as string.
 * @returns {PdfMeasurementUnit} measurement unit.
 */
export declare function _mapMeasurementUnit(unitString: string): PdfMeasurementUnit;
/**
 * Map markup annotation type.
 *
 * @private
 * @param {string} text markup type as string.
 * @returns {PdfTextMarkupAnnotationType} markup type as name.
 */
export declare function _mapMarkupAnnotationType(text: string): PdfTextMarkupAnnotationType;
/**
 * Reverse text markup annotation type.
 *
 * @private
 * @param {PdfTextMarkupAnnotationType} type markup type.
 * @returns {string} markup type as name.
 */
export declare function _reverseMarkupAnnotationType(type: PdfTextMarkupAnnotationType): string;
/**
 * Map graphics unit.
 *
 * @private
 * @param {string} unitString String value.
 * @returns {_PdfGraphicsUnit} PDF graphics unit.
 */
export declare function _mapGraphicsUnit(unitString: string): _PdfGraphicsUnit;
/**
 * Map rubber stamp icon.
 *
 * @private
 * @param {string} iconString String value.
 * @returns {PdfRubberStampAnnotationIcon} Rubber stamp icon.
 */
export declare function _mapRubberStampIcon(iconString: string): PdfRubberStampAnnotationIcon;
/**
 * Map popup icon.
 *
 * @private
 * @param {string} iconString String value.
 * @returns {PdfRubberStampAnnotationIcon} Popup icon.
 */
export declare function _mapPopupIcon(iconString: string): PdfPopupIcon;
/**
 * Convert annotation state to string value.
 *
 * @private
 * @param {PdfAnnotationState} type Annotation state.
 * @returns {string} String value.
 */
export declare function _reverseMapAnnotationState(type: PdfAnnotationState): string;
/**
 * Convert string value to annotation state.
 *
 * @private
 * @param {string} type String value.
 * @returns {PdfAnnotationState} Annotation state.
 */
export declare function _mapAnnotationState(type: string): PdfAnnotationState;
/**
 * Convert annotation state model to string value.
 *
 * @private
 * @param {PdfAnnotationStateModel} type Annotation state model.
 * @returns {string} String value.
 */
export declare function _reverseMapAnnotationStateModel(type: PdfAnnotationStateModel): string;
/**
 * Convert string value to annotation state model.
 *
 * @private
 * @param {string} type String value.
 * @returns {PdfAnnotationStateModel} Annotation state model.
 */
export declare function _mapAnnotationStateModel(type: string): PdfAnnotationStateModel;
/**
 * Map attachment icon.
 *
 * @private
 * @param {string} iconString String value.
 * @returns {PdfAttachmentIcon} Icon.
 */
export declare function _mapAttachmentIcon(iconString: string): PdfAttachmentIcon;
/**
 * Map attachment intent.
 *
 * @private
 * @param {string} intentString String value.
 * @returns {PdfAnnotationIntent} intent.
 */
export declare function _mapAnnotationIntent(intentString: string): PdfAnnotationIntent;
/**
 * Convert PDF font style to string value.
 *
 * @private
 * @param {PdfFontStyle} style Font style.
 * @returns {string} String value.
 */
export declare function _reverseMapPdfFontStyle(style: PdfFontStyle): string;
/**
 * Get special character.
 *
 * @private
 * @param {string} input Input string.
 * @returns {string} String value.
 */
export declare function _getSpecialCharacter(input: string): string;
/**
 * Get latin character.
 *
 * @private
 * @param {string} input Input string.
 * @returns {string} String value.
 */
export declare function _getLatinCharacter(input: string): string;
/**
 * Encode value to string.
 *
 * @private
 * @param {string} value Input string.
 * @returns {string} result.
 */
export declare function _encodeValue(value: string): string;
/**
 * Parse and retrieve comments and review history from the annotation.
 *
 * @private
 * @param {PdfComment} annotation Input annotation.
 * @param {boolean} isReview Input is review or not.
 * @returns {PdfPopupAnnotationCollection} result.
 */
export declare function _getCommentsOrReview(annotation: PdfComment, isReview: boolean): PdfPopupAnnotationCollection;
/**
 * Returns true if input dictionary is belongs to the review history.
 *
 * @private
 * @param {_PdfDictionary} dictionary Input dictionary.
 * @returns {boolean} Input is review or not.
 */
export declare function _checkReview(dictionary: _PdfDictionary): boolean;
/**
 * Returns true if input dictionary is belongs to the comments.
 *
 * @private
 * @param {_PdfDictionary} dictionary Input dictionary.
 * @returns {boolean} Input is comments or not.
 */
export declare function _checkComment(dictionary: _PdfDictionary): boolean;
/**
 * Update visibility.
 *
 * @private
 * @param {_PdfDictionary} dictionary Input dictionary.
 * @param {PdfFormFieldVisibility} value Visibility.
 * @returns {void} Nothing.
 */
export declare function _updateVisibility(dictionary: _PdfDictionary, value: PdfFormFieldVisibility): void;
/**
 * Remove duplicate reference.
 *
 * @private
 * @param {_PdfDictionary} dictionary Input dictionary.
 * @param {_PdfCrossReference} crossTable Cross reference table.
 * @param {string} key Key string for appearance type.
 * @returns {void} Nothing.
 */
export declare function _removeDuplicateReference(dictionary: _PdfDictionary, crossTable: _PdfCrossReference, key: string): void;
/**
 * Remove duplicate reference from resources.
 *
 * @private
 * @param {_PdfDictionary} resources Input resources.
 * @param {_PdfCrossReference} crossTable Cross reference table.
 * @returns {void} Nothing.
 */
export declare function _removeDuplicateFromResources(resources: _PdfDictionary, crossTable: _PdfCrossReference): void;
/**
 * Remove duplicate reference.
 *
 * @private
 * @param {any} normal Input.
 * @param {_PdfCrossReference} crossReference Cross reference table.
 * @param {string} firstKey Key string for appearance type.
 * @param {string} secondKey Key string for appearance type.
 * @returns {void} Nothing.
 */
export declare function _removeReferences(normal: any, crossReference: _PdfCrossReference, firstKey: string, secondKey: string): void;
/**
 * Represents the base class for all custom exceptions.
 * Provides a message and a name for the exception.
 */
export declare class BaseException {
    /**
     * The error message describing the exception.
     */
    message: string;
    /**
     * The name of the exception type.
     */
    name: string;
    /**
     * Creates a new BaseException instance.
     *
     * @private
     * @param {string} message - The error message.
     * @param {string} name - The name of the exception.
     */
    constructor(message: string, name: string);
}
/**
 * Represents an error related to invalid format.
 * Extends BaseException.
 */
export declare class FormatError extends BaseException {
    /**
     * Creates a new FormatError instance.
     *
     * @param {string} message - The error message describing the format issue.
     */
    constructor(message: string);
}
/**
 * Represents an error thrown when the parser reaches the end of the file unexpectedly.
 * Extends BaseException.
 */
export declare class ParserEndOfFileException extends BaseException {
    /**
     * Creates a new ParserEndOfFileException instance.
     *
     * @param {string} message - The error message describing the EOF condition.
     */
    constructor(message: string);
}
/**
 * Gets the default string.
 *
 * @private
 * @param {string} item Input string.
 * @returns {string} result.
 */
export declare function _defaultToString(item: string | number | string[] | number[] | Object | Object[] | boolean): string;
/**
 * Gets the form field font.
 *
 * @private
 * @param {PdfForm} form form.
 * @param {PdfWidgetAnnotation} widget widget annotation.
 * @param {PdfField} field field.
 * @returns {PdfFont} font.
 */
export declare function _obtainFontDetails(form: PdfForm, widget: PdfWidgetAnnotation, field?: PdfField): PdfFont;
/**
 * Gets the form field font metrics.
 *
 * @private
 * @param {_PdfDictionary} fontDictionary Form field.
 * @param {number} height Font family.
 * @param {string} baseFontName Font name.
 * @param {PdfStandardFont} font The font.
 * @returns {_PdfFontMetrics} Font metrics.
 */
export declare function _createFontMetrics(fontDictionary: _PdfDictionary, height: number, baseFontName: string, font: PdfStandardFont): _PdfFontMetrics;
/**
 * Gets the form field font size.
 *
 * @private
 * @param {PdfField} field Form field.
 * @param {PdfFontFamily} family Font family.
 * @returns {number} Font size.
 */
export declare function _getFontSize(field: PdfField, family: PdfFontFamily): number;
/**
 * Gets the form field font family.
 *
 * @private
 * @param {string} name Font name.
 * @returns {PdfFontFamily} Font family.
 */
export declare function _getFontFamily(name: string): PdfFontFamily;
/**
 * Gets the font style.
 *
 * @private
 * @param {string} fontFamilyString Font family string.
 * @returns {PdfFontStyle} result.
 */
export declare function _getFontStyle(fontFamilyString: string): PdfFontStyle;
/**
 * Map the font.
 *
 * @private
 * @param {string} name Font name.
 * @param {number} size Font size.
 * @param {PdfFontStyle} style Font style.
 * @param {PdfAnnotation} annotation Annotation or Field.
 * @param {_PdfDictionary} fontDictionary Font dictionary.
 * @returns {PdfFont} result.
 */
export declare function _mapFont(name: string, size: number, style: PdfFontStyle, annotation: PdfAnnotation | PdfField, fontDictionary?: _PdfDictionary): PdfFont;
/**
 * Checks if a font resource from the field's appearance stream is also defined in the form's default resources.
 *
 * @private
 * @param {PdfAnnotation | PdfField} annotation The annotation or field object.
 * @returns {boolean} Returns `true` if the form field appearance font has a form object font resource.
 */
export declare function _hasSharedFontResource(annotation: PdfAnnotation | PdfField): boolean;
/**
 * Gets the font stream.
 *
 * @private
 * @param {_PdfCrossReference} crossReference Cross reference.
 * @param {PdfAnnotation} annotation Annotation.
 * @param {string} fontResourceName Font resource name.
 * @returns {Uint8Array} result.
 */
export declare function _tryParseFontStream(crossReference: _PdfCrossReference, annotation: PdfAnnotation | PdfField, fontResourceName?: string): Uint8Array;
/**
 * Gets the font data.
 *
 * @private
 * @param {_PdfDictionary} dictionary font dictionary.
 * @returns {Uint8Array} result.
 */
export declare function _getFontFromDescriptor(dictionary: _PdfDictionary): Uint8Array;
/**
 * Gets the boolean if two arrays are equal.
 *
 * @private
 * @param {Array<number[]>} inkPointsCollection Ink points collection.
 * @param {Array<number[]>} previousCollection Previous collection.
 * @returns {boolean} result.
 */
export declare function _checkInkPoints(inkPointsCollection: Point[][], previousCollection: Point[][]): boolean;
/**
 * Update the annotation bounds.
 *
 * @private
 * @param {PdfAnnotation} annotation annotation.
 * @param {number[]} bounds annotation bounds.
 * @returns {number[]} bounds.
 */
export declare function _updateBounds(annotation: PdfAnnotation, bounds?: number[]): number[];
/**
 * Trim a specific trailing substring from the end of a string, if it matches exactly.
 *
 * @private
 * @param {string} s - The input string.
 * @param {string} tail - The exact tail to remove.
 * @returns {string} The trimmed or original string.
 */
export declare function _trimTailIfMatches(s: string, tail: string): string;
/**
 * Decode text.
 *
 * @private
 * @param {string} text Text to decode.
 * @param {boolean} isColorSpace Color space or not
 * @param {boolean} isPassword Password or not
 * @returns {string} Decoded text.
 */
export declare function _decodeText(text: string, isColorSpace: boolean, isPassword: boolean): string;
/**
 * Decodes a UTF 16 byte array (big-endian or little-endian) into a string.
 *
 * @private
 * @param {Uint8Array} bytes - Even-length UTF 16 byte sequence.
 * @param {boolean} isBE - Whether the byte order is big-endian (`true` for UTF 16BE, `false` for UTF 16LE).
 * @returns {string} The decoded string.
 */
export declare function _decodeUtf16Bytes(bytes: Uint8Array, isBE: boolean): string;
/**
 * Number of bytes required to save the number.
 *
 * @private
 * @param {number} input number.
 * @returns {number} number of bytes.
 */
export declare function _getSize(input: number): number;
/**
 * Convert the string to big endian bytes.
 *
 * @private
 * @param {string} input string.
 * @returns {number[]} bytes.
 */
export declare function _stringToBigEndianBytes(input: string): number[];
/**
 * Convert number respect to ordered list number style.
 *
 * @private
 * @param {number} intArabic Input value.
 * @param {PdfNumberStyle} numberStyle Number style.
 * @returns {string} String value.
 */
export declare function _convertNumber(intArabic: number, numberStyle: PdfNumberStyle): string;
/**
 * Convert arabic numbers to roman style.
 *
 * @private
 * @param {number} intArabic Input value.
 * @returns {string} String value.
 */
export declare function _arabicToRoman(intArabic: number): string;
/**
 * Convert arabic numbers to alphabet.
 *
 * @private
 * @param {number} arabic Input value.
 * @returns {string} String value.
 */
export declare function _arabicToLetter(arabic: number): string;
/**
 * Convert character code to string.
 *
 * @private
 * @param {number} value Input value.
 * @returns {string} String value.
 */
export declare function _appendChar(value: number): string;
/**
 * Check whether the value is null or undefined.
 *
 * @private
 * @param {any} value Input value.
 * @returns {boolean} Return true if the value is null or undefined; otherwise, return false
 */
export declare function _isNullOrUndefined(value: any): boolean;
/**
 * Defines a property on an object with specific attributes.
 *
 * @piq
 * @param {Object} obj - The target object on which the property will be defined.
 * @param {string} prop - The name of the property to define.
 * @param {any} value - The value to assign to the property.
 * @param {boolean} [serializable = false] - If true, the property will not be enumerable.
 * @returns {any} The value of the property that was defined.
 *
 */
export declare function _defineProperty(obj: any, prop: string, value: any, serializable?: boolean): any;
/**
 * Compresses the content of a PDFBaseStream
 *
 * @private
 * @param {_PdfBaseStream} stream - Base stream to compress.
 * @param {boolean} isExport - Denotes compress the stream as a hex-encoded string.
 * @returns {boolean} compressed string.
 */
export declare function _compressStream(stream: _PdfBaseStream, isExport?: boolean): string;
/**
 * Check whether the input string contains any right-to-left (RTL) characters.
 *
 * @private
 * @param {string} input The input string.
 * @returns {boolean} Returns true if the string contains any RTL characters; otherwise, returns false.
 */
export declare function _isRightToLeftCharacters(input: string): boolean;
/**
 * Updates the page count value in the dictionary
 *
 * @private
 * @param {_PdfDictionary} dictionary - Dictionary to update page count.
 * @param {number} valueToIncrement - Page count.
 * @returns {void} Nothing.
 */
export declare function _updatePageCount(dictionary: _PdfDictionary, valueToIncrement: number): void;
/**
 * Updates the page settings in the dictionary
 *
 * @private
 * @param {_PdfDictionary} dictionary - Dictionary to update page settings.
 * @param {PdfPageSettings} settings - PDF page settings.
 * @returns {void} Nothing.
 */
export declare function _updatePageSettings(dictionary: _PdfDictionary, settings: PdfPageSettings): void;
/**
 * Checks if the given string contains any Unicode (non-ASCII) characters.
 *
 * @private
 * @param {string} value - The string to check for Unicode characters.
 * @returns {boolean} `true` if the string contains at least one Unicode character; otherwise, `false`.
 */
export declare function _hasUnicodeCharacters(value: string): boolean;
/**
 * Creates a font stream for the given font and form, extracting the font data from font descriptors.
 *
 * @private
 * @param {PdfForm} form - The target PDF form containing cross-references to the font data.
 * @param {_PdfDictionary} font - The dictionary that defines the font, containing references to font descriptors.
 * @returns {Uint8Array} The font data extracted from the font file.
 */
export declare function _createFontStream(form: PdfForm, font: _PdfDictionary): Uint8Array;
/**
 * Determines whether a given string contains Unicode characters.
 *
 * @private
 * @param {string} value - The string to be checked.
 * @returns {boolean} True if the string contains Unicode characters; otherwise, false.
 * @throws {Error} If the input value is null or undefined.
 */
export declare function _isUnicode(value: string): boolean;
/**
 * Converts a single hexadecimal character to its numeric value.
 *
 * @private
 * @param {string} char - A single character string representing a hexadecimal digit ('0'-'9', 'A'-'F', 'a'-'f').
 * @returns {number} The numeric value corresponding to the hexadecimal character.
 * @throws {Error} Throws an error if the input character is not a valid hexadecimal character.
 */
export declare function _convertToHex(char: string): number;
/**
 * Decodes a font family string that contains hexadecimal encoded characters.
 *
 * @private
 * @param {string} fontFamily - The font family string to be decoded. May contain hex encoded characters prefixed by '#'.
 * @returns {string} The decoded font family string with hex characters replaced by their ASCII equivalents.
 * @throws {Error} Throws an error if the input contains invalid hexadecimal sequences.
 */
export declare function _decodeFontFamily(fontFamily: string): string;
/**
 * Updates the border style to dashed pattern if the border style is set to dashed.
 *
 * @private
 * @param {PdfInteractiveBorder} border - The interactive border object containing style information.
 * @param {_PaintParameter} parameter - The paint parameter object that contains the border pen to be updated.
 * @returns {void} Nothing.
 */
export declare function _updateDashedBorderStyle(border: PdfInteractiveBorder, parameter: _PaintParameter): void;
/**
 * Reads a 16-bit unsigned integer from the specified offset in the given data array.
 *
 * @private
 * @param {Uint8Array} data - The data array containing the bytes.
 * @param {number} offset - The position in the data array to start reading.
 * @returns {number} The 16-bit unsigned integer read from the data array.
 */
export declare function _readUnsignedInteger16(data: Uint8Array, offset: number): number;
/**
 * Sets the rotation angle for a PDF annotation if necessary.
 * It ensures that the rotation is within the normalized range [0, 360) degrees.
 *
 * @private
 * @param {number} rotateAngle - The rotation angle to be set for the annotation. Negative values are normalized.
 * @param {PdfAnnotation} annot - The PDF annotation object which may have its rotation angle modified.
 * @returns {void} Nothing.
 */
export declare function _setRotateAngle(rotateAngle: number, annot: PdfAnnotation): void;
/**
 * Reads a 32-bit unsigned integer from the specified offset in the given data array.
 *
 * @private
 * @param {Uint8Array} data - The data array containing the bytes.
 * @param {number} offset - The position in the data array to start reading.
 * @returns {number} The 32-bit unsigned integer read from the data array.
 */
export declare function _readUnsignedInteger32(data: Uint8Array, offset: number): number;
/**
 * Reads a signed 8-bit integer from the specified offset in the given data array.
 *
 * @private
 * @param {Uint8Array} data - The data array containing the bytes.
 * @param {number} offset - The position in the data array to start reading.
 * @returns {number} The 8-bit signed integer read from the data array.
 */
export declare function _readInteger8(data: Uint8Array, offset: number): number;
/**
 * Calculates the base-2 logarithm of a number and rounds it up to the nearest integer.
 *
 * @private
 * @param {number} x - The number to calculate the logarithm for.
 * @returns {number} The smallest integer greater than or equal to the logarithm of x to base 2; returns 0 if x is less than or equal to 0.
 */
export declare function _log2(x: number): number;
/**
 * Defines a non-enumerable property on an object.
 *
 * @private
 * @param {object} obj - The object on which to define the property.
 * @param {string} prop - The name of the property to define.
 * @param {*} value - The value of the property.
 * @param {boolean} [nonSerializable=false] - Indicates whether the property should be enumerable.
 * @returns {*} The value that was set for the property.
 */
export declare function _defineLazyProperty(obj: any, prop: any, value: any, nonSerializable?: boolean): any;
/**
 * Clamps a number between a minimum and maximum value.
 *
 * @private
 * @param {number} v - The number to clamp.
 * @param {number} min - The minimum value.
 * @param {number} max - The maximum value.
 * @returns {number} The clamped value.
 */
export declare function _mathClamp(v: number, min: number, max: number): number;
/**
 * Throws an error with the given message.
 *
 * @private
 * @param {string} msg - The error message.
 * @returns {void} This function does not return a value.
 */
export declare function _unreachable(msg: string): void;
/**
 * Converts a grayScale image data array to an RGBA image data array.
 *
 * @private
 * @param {Uint8Array} src - The source grayScale data array.
 * @param {Uint32Array} dest - The destination RGBA data array.
 * @returns {void} This function does not return a value.
 */
export declare function _grayToRgba(src: Uint8Array, dest: Uint32Array): void;
/**
 * Checks if the current environment is little-endian.
 *
 * @private
 * @returns {boolean} True if the environment is little-endian, false otherwise.
 */
export declare function _isLittleEndian(): boolean;
/**
 * Extracts the attributes element from a DER-encoded ASN1 collection.
 *
 * @private
 * @param {_PdfUniqueEncodingElement} abstractSyntaxCollection - The ASN1 collection from which attributes are to be extracted.
 * @returns {_PdfUniqueEncodingElement | undefined} The extracted attributes element if valid, otherwise undefined.
 */
export declare function _extractAttributes(abstractSyntaxCollection: _PdfUniqueEncodingElement): _PdfUniqueEncodingElement;
/**
 * Compares two Uint8Array instances for byte-wise equality.
 *
 * @private
 * @param {Uint8Array} a - The first Uint8Array to compare.
 * @param {Uint8Array} b - The second Uint8Array to compare.
 * @returns {boolean} Returns true if both arrays are equal in length and content, otherwise false.
 */
export declare function _areUint8ArraysEqual(a: Uint8Array, b: Uint8Array): boolean;
/**
 * Computes modular exponentiation: (base^exp) mod mod.
 * Efficiently calculates large powers using the right-to-left binary method.
 *
 * @private
 * @param {bigint} base - The base number.
 * @param {bigint} exp - The exponent.
 * @param {bigint} mod - The modulus.
 * @returns {bigint} The result of (base^exp) % mod.
 */
export declare function _modPow(base: bigint, exp: bigint, mod: bigint): bigint;
/**
 * Computes the modular inverse of a number `a` modulo `m`.
 * That is, finds `x` such that (a * x) % m === 1.
 * Uses the Extended Euclidean Algorithm.
 *
 * @private
 * @param {bigint} a - The number to find the inverse of.
 * @param {bigint} m - The modulus.
 * @returns {bigint} The modular inverse of `a` modulo `m`, or 0 if no inverse exists.
 */
export declare function _modInverse(a: bigint, m: bigint): bigint;
/**
 * Converts a Uint8Array to a BigInt by interpreting the bytes as a big-endian integer.
 *
 * @private
 * @param {Uint8Array} bytes - The byte array to convert.
 * @returns {bigint} The resulting BigInt value.
 */
export declare function _bytesToBigInt(bytes: Uint8Array): bigint;
/**
 * Converts a BigInt to a Uint8Array using big-endian byte order.
 *
 * @private
 * @param {bigint} n - The BigInt value to convert.
 * @returns {Uint8Array} The resulting byte array.
 */
export declare function _bigIntToBytes(n: bigint): Uint8Array;
/**
 * Generates a cryptographically insecure random BigInt of the specified bit length.
 * The result is a non-negative BigInt with up to `bitLength` bits.
 *
 * @private
 * @param {number} bitLength - The desired bit length of the random number.
 * @returns {bigint} A randomly generated BigInt.
 */
export declare function _randomBigInt(bitLength: number): bigint;
/**
 * Generates a random BigInt within the inclusive range [min, max].
 * Uses rejection sampling to ensure uniform distribution.
 * Falls back to a smaller random if no valid candidate is found after 1000 attempts.
 *
 * @private
 * @param {bigint} min - The minimum value (inclusive).
 * @param {bigint} max - The maximum value (inclusive).
 * @returns {bigint} A random BigInt between min and max.
 */
export declare function _createRandomInRange(min: bigint, max: bigint): bigint;
/**
 * Handle explicit conversion
 *
 * @private
 * @param {Uint8Array} value - Input value.
 * @returns {Uint8Array} Converted value.
 */
export declare function _handleExplicitConversion(value: Uint8Array): Uint8Array;
/**
 * Returns a function that converts a value to bigint.
 *
 * @private
 * @returns {bigint} The bigInt
 */
export declare function _getBigInt(): (value: string | number | boolean) => bigint;
/**
 * Pads a single-digit number with a leading zero to ensure two-digit formatting.
 *
 * @private
 * @param {number} value - The number to pad.
 * @returns {string} A string representing the number with at least two digits.
 */
export declare function _pad2(value: number): string;
/**
 * Converts a Date object to a string in the PDF date format 'D:YYYYMMDDHHMMSSOHH'MM'SS''.
 *
 * @private
 * @param {Date} dateTime - The Date object to be converted to a string.
 * @returns {string} A string representing the date and time in the PDF format.
 */
export declare function _convertDateToString(dateTime: Date): string;
/**
 * Converts a PDF date string into a JavaScript Date object.
 *
 * @private
 * @param {string} date - The date string to convert.
 * @returns {Date} A JavaScript Date object representing the converted date.
 */
export declare function _convertStringToDate(date: string): Date;
/**
 * Returns the appropriate CJK font encoding name based on the specified `PdfCjkFontFamily`.
 *
 * @private
 * @param {PdfCjkFontFamily} fontFamily The  cjk font family.
 * @returns {_PdfName} representing the encoding name suitable for the given font family.
 */
export declare function _getCjkEncoding(fontFamily: PdfCjkFontFamily): _PdfName;
/**
 * Creates and returns a descendant CIDFont dictionary for a specified CJK font family.
 *
 * @private
 * @param {PdfCjkFontFamily} family - The CJK font family to be used.
 * @param {PdfFontStyle} style - The font style to apply.
 * @param {_PdfFontMetrics} metrics - The font metrics containing width table, PostScript name, and other font-specific data.
 * @returns {_PdfDictionary[]} An array containing a single `_PdfDictionary` that represents the descendant font definition.
 */
export declare function _getCjkDescendantFont(family: PdfCjkFontFamily, style: PdfFontStyle, metrics: _PdfFontMetrics): _PdfDictionary[];
/**
 * Returns the CIDSystemInfo dictionary for the specified CJK font family.
 *
 * @private
 * @param {PdfCjkFontFamily} family - The CJK font family for which the system information is needed.
 * @returns {_PdfDictionary} A `_PdfDictionary` containing the CIDSystemInfo entries.
 */
export declare function _getCjkSystemInfo(family: PdfCjkFontFamily): _PdfDictionary;
/**
 * Resolves and returns the corresponding `PdfFontFamily` enum value based on the given PostScript font name.
 *
 * @private
 * @param {string} postScriptName - The PostScript name of the font.
 * @returns {PdfFontFamily} The resolved `PdfFontFamily` enum value corresponding to the font name.
 */
export declare function _resolveStandardFontFamily(postScriptName: string): PdfFontFamily;
/**
 * Resolves and returns the corresponding `PdfCjkFontFamily` enum value based on the given PostScript font name.
 *
 * @private
 * @param {string} postScriptName - The PostScript name of the CJK font.
 * @returns {PdfCjkFontFamily} The resolved `PdfCjkFontFamily` enum value corresponding to the font name.
 * @throws {Error} Error if the font name does not match any known CJK font family.
 */
export declare function _resolveCjkFontFamily(postScriptName: string): PdfCjkFontFamily;
/**
 * Pads the current string with another string (multiple times, if needed)
 *
 * @private
 * @param {string} str - The original string to be padded.
 * @param {number} targetLength - The desired length
 * @param {string} [padString='0'] - The string to pad the original string with.
 * @returns {string} The padded string if the original string length is less than the target length. Returns the original string otherwise.
 */
export declare function _padStart(str: string, targetLength: number, padString?: string): string;
/**
 * Converts a Uint8Array to a hexadecimal string representation.
 *
 * @private
 * @param {Uint8Array} buffer - The input byte array to convert.
 * @returns {string} A hexadecimal string representation of the input.
 */
export declare function _bytesToHex(buffer: Uint8Array): string;
/**
 * Formats a number according to the current style.
 *
 * @private
 * @param {number} value The numeric value.
 * @param {PdfNumberStyle} numberStyle The numeric value.
 * @returns {string} The formatted string.
 */
export declare function _formatNumber(value: number, numberStyle: PdfNumberStyle): string;
/**
 * Converts a number to Roman numerals.
 *
 * @private
 * @param {number} num The number to convert.
 * @returns {string} The Roman numeral representation.
 */
export declare function _toRoman(num: number): string;
/**
 * Converts a number to alphabetic representation.
 *
 * @private
 * @param {number} num The number to convert.
 * @returns {string} The alphabetic representation.
 */
export declare function _toAlpha(num: number): string;