UNPKG

@syncfusion/ej2-pdf

Version:

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

140 lines (139 loc) 4.92 kB
import { _PdfName, _PdfDictionary } from './pdf-primitives'; import { _PdfStream, _PdfBaseStream } from './base-stream'; import { _PdfCrossReference } from './pdf-cross-reference'; import { _PdfEncryptor } from './security/encryptor'; import { _CipherTransform } from './security/encryptors/cipher-tranform'; /** * Scans PDF byte streams and tokenizes them into primitive objects and commands. * * @private */ export declare class _PdfLexicalOperator { stream: any; stringBuffer: Array<string>; /** * Tracks the number of hex digits processed while reading a hex string. * * @private */ _hexStringNumber: number; beginInlineImagePosition: number; currentChar: number; /** * Indicates whether the lexer operates in Forms Data Format (FDF) mode. * * @private */ _isFormsDataFormat: boolean; /** * Indicates whether the lexer is operating in annotation import mode. * * @private */ _isAnnotationImport: boolean; constructor(stream: any, isFormDataFormat?: boolean, isAnnotationImport?: boolean); nextChar(): number; peekChar(): number; getNumber(): number; getString(): string; getName(): _PdfName; getHexString(): string; getObject(): any; peekObj(): any; skipToNextLine(): void; /** * Converts an ASCII hex character code to its numeric value or -1 if invalid. * * @private * @param {number} ch Character code to convert. * @returns {number} Numeric value in the range 0 to 15, or -1 if not a hex digit. */ _toHexDigit(ch: number): number; } /** * Parses PDF tokens into objects, arrays, dictionaries, streams, and inline images, including decryption and decoding. * * @private */ export declare class _PdfParser { lexicalOperator: _PdfLexicalOperator; xref: _PdfCrossReference; allowStreams: boolean; recoveryMode: boolean; imageCache: Map<string, _PdfBaseStream>; first: any; second: any; private _isColorSpace; private _isPassword; /** * Encryptor used to create cipher transforms for encrypted objects. * * @private */ _encryptor: _PdfEncryptor; /** * Indicates whether parsing is performed for raw image extraction. * * @private */ _isImageExtraction: boolean; constructor(lexicalOperator: _PdfLexicalOperator, xref: _PdfCrossReference, allowStreams?: boolean, recoveryMode?: boolean, encryptor?: _PdfEncryptor); refill(): void; shift(): void; tryShift(): boolean; getObject(cipherTransform?: _CipherTransform): any; getObject(objectNumber?: number, generationNumber?: number | boolean, isCipherTransform?: boolean): any; findDiscreteDecodeInlineStreamEnd(stream: any): number; findDecodeInlineStreamEnd(stream: any): number; findHexDecodeInlineStreamEnd(stream: any): number; inlineStreamSkipEI(stream: any): void; makeInlineImage(cipher?: _CipherTransform): any; makeInlineImage(objectNumber?: number, generationNumber?: number, isCipherTransform?: boolean): any; /** * Computes a lightweight checksum used as a cache key for byte arrays. * * @private * @param {Uint8Array} bytes Byte array to hash. * @returns {number} Computed checksum value. */ _computeMaxNumber(bytes: Uint8Array): number; makeStream(dictionary: _PdfDictionary, cipherTransform?: _CipherTransform, makeFilter?: boolean): any; filter(stream: any, dictionary: _PdfDictionary, length: number): any; makeFilter(stream: any, name: string, maybeLength: number, params: any): any; /** * Searches forward from the given position to locate a signature and compute the stream length. * * @private * @param {number} startPosition Start position within the source stream. * @param {Uint8Array} signature Byte sequence that marks the end of the stream. * @returns {number} Length from the start position to the signature, or -1 if not found. */ _findStreamLength(startPosition: number, signature: Uint8Array): number; findDefaultInlineStreamEnd(stream: any): number; /** * Determines whether the parser has reached the end-of-file token. * * @private * @returns {boolean} `true` if EOF is reached; otherwise, `false`. */ _checkEnd(): boolean; } /** * Parses and validates the PDF Linearization dictionary and exposes linearization hints. * * @private */ export declare class _Linearization { length: number; xref: _PdfCrossReference; hints: number[]; objectNumberFirst: number; endFirst: number; pageCount: number; mainXRefEntriesOffset: number; pageFirst: number; isValid: boolean; constructor(stream: _PdfStream); getInt(dictionary: _PdfDictionary, name: string, allowZeroValue?: boolean): number; getHints(dictionary: _PdfDictionary): number[]; }