UNPKG

@syncfusion/ej2-pdf

Version:

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

228 lines (227 loc) 6.3 kB
import { _PdfCrossReference } from './pdf-cross-reference'; /** * Represents an internal PDF name object with interning support. * * @private */ export declare class _PdfName { constructor(name: string); name: string; static get(name: string): _PdfName; } /** * Represents an internal PDF command/operator token. * * @private */ export declare class _PdfCommand { constructor(command: string); command: string; static get(command: string): _PdfCommand; } /** * Represents an internal indirect object reference (object number and generation). * * @private */ export declare class _PdfReference { constructor(objectNumber: number, gen: number); objectNumber: number; generationNumber: number; /** * Indicates whether this reference points to a newly created object. * * @private */ _isNew: boolean; toString(): string; static get(objectNumber: number, generationNumber: number): _PdfReference; } /** * Maintains a set of object references, primarily for cycle detection and tracking. * * @private */ export declare class _PdfReferenceSet { constructor(parent?: any); /** * Backing set that stores reference identity strings. * * @private */ _set: Set<_PdfReference>; has(ref: any): boolean; put(ref: any): void; remove(ref: any): void; clear(): void; } /** * Provides a cache keyed by reference identity strings for quick object lookup. * * @private */ export declare class _PdfReferenceSetCache { constructor(); /** * Internal map from reference string or object id to cached object. * * @private */ _map: any; readonly size: number; get(ref: _PdfReference): any; has(ref: _PdfReference): boolean; put(ref: _PdfReference, obj: any): void; set(objId: string, obj: any): void; clear(): void; } export interface IDictionaryPair<K, V> { key: K; value: V; } export declare class Dictionary<K, V> { protected table: { [key: string]: IDictionaryPair<K, V>; }; protected nElements: number; protected toStr: (key: K) => string; constructor(toStringFunction?: (key: K) => string); getValue(key: K): V; setValue(key: K, value: V): V; keys(): K[]; containsKey(key: K): boolean; _size(): number; } /** * Represents a low-level PDF dictionary with cross-reference aware accessors. * * @private */ export declare class _PdfDictionary { constructor(xref?: _PdfCrossReference); /** * Internal storage for dictionary key-value pairs. * * @private */ _map: any; /** * Cross-reference table used to resolve indirect references. * * @private */ _crossReference: _PdfCrossReference; objId: any; /** * Indicates whether this dictionary represents a newly created object. * * @private */ _isNew: boolean; suppressEncryption: boolean; /** * Indicates whether the dictionary has been modified since loading. * * @private */ _updated: boolean; isCatalog: boolean; /** * Holds the current resolved object context, if any. * * @private */ _currentObj: any; /** * Indicates whether this dictionary corresponds to a font object. * * @private */ _isFont: boolean; /** * Indirect reference associated with this dictionary. * * @private */ _reference: _PdfReference; /** * Indicates whether this dictionary has been processed during parsing. * * @private */ _isProcessed: boolean; /** * Indicates whether this dictionary represents a signature object. * * @private */ _isSignature: boolean; /** * Indicates whether this dictionary has been visited to prevent circular dependencies. * * @private */ _isVisited: boolean; readonly size: number; assignXref(xref: any): void; getRaw(key: string): any; getRawValues(): any; get(key1: string, key2?: string, key3?: string): any; getArray(key1: string, key2?: string, key3?: string): any[] | undefined; set(key: string, value: any): void; has(key: string): boolean; forEach(callback: any): void; update(key: string, value: any): void; static getEmpty(xref: _PdfCrossReference): _PdfDictionary; static merge(xref: _PdfCrossReference, dictionaryArray: Array<any>, mergeSubDictionary?: boolean): _PdfDictionary; /** * Initializes the dictionary with default state and assigns the cross-reference if provided. * * @private * @param {_PdfCrossReference} [xref] Cross-reference table for resolving references. */ _initialize(xref?: _PdfCrossReference): void; /** * Retrieves a raw value by trying up to three alternative keys without dereferencing. * * @private * @param {string} key1 Primary key to look up. * @param {string} [key2] Secondary key to try if the first is missing. * @param {string} [key3] Tertiary key to try if the first two are missing. * @returns {any} The stored value, if present. */ _get(key1: string, key2?: string, key3?: string): any; } /** * Represents a null placeholder for internal use. * * @private */ export declare class _PdfNull { constructor(value?: any); value: any; } /** * Clears all primitive object intern caches for names, commands, and references. * * @private */ export declare function _clearPrimitiveCaches(): void; /** * Determines whether a value is a PDF name and optionally matches the given name. * * @private * @param {any} value The value to test. * @param {string} name Optional name to compare against. * @returns {boolean} `true` if the value is a name (and matches when provided). */ export declare function _isName(value: any, name: string): boolean; /** * Determines whether a value is a PDF command and optionally matches the given command string. * * @private * @param {any} value The value to test. * @param {string} command Optional command string to compare against. * @returns {boolean} `true` if the value is a command (and matches when provided). */ export declare function _isCommand(value: any, command: string): boolean;