import { _PdfCrossReference, _PdfDictionary, PdfPage, Rectangle } from '@syncfusion/ej2-pdf'; import { _GraphicState, _TextState } from './graphic-state'; import { _FontStructure } from './text-extraction/font-structure'; import { TextGlyph, TextLine, TextWord } from './text-structure'; import { _MatrixHelper } from './text-extraction/matrix-helper'; import { _PdfContentParserHelper } from './content-parser-helper'; import { PdfRedactionRegion } from './redaction/pdf-redaction-region'; /** * Internal PDF text parser responsible for extracting glyphs, words and lines. * * @private */ export declare class _PdfTextParser { /** * Internal collection of extracted text glyphs. * * @private */ _textGlyph: TextGlyph[]; /** * Internal collection of extracted text words. * * @private */ _textWord: TextWord[]; /** * Internal collection of extracted text lines. * * @private */ _textLine: TextLine[]; /** * Internal aggregated extracted text string. * * @private */ _extractedText: string; /** * Internal width accumulator. * * @private */ _width: number; /** * Internal height accumulator. * * @private */ _height: number; /** * Internal generic index counter. * * @private */ _index: number; /** * Internal current font size. * * @private */ _fontSize: number; /** * Internal array of encoded text tokens. * * @private */ _encodedText: string[]; /** * Internal previous glyph bounding rectangle. * * @private */ _previousRect: Rectangle; /** * Internal current bounding rectangle. * * @private */ _boundingRectangle: Rectangle; /** * Translate a matrix by (x,y) returning a new MatrixHelper. * * @private * @param {number} x - translation x * @param {number} y - translation y * @param {_MatrixHelper} textMatrix - matrix to translate * @returns {_MatrixHelper} translated matrix */ _translateTextMatrix(x: number, y: number, textMatrix: _MatrixHelper): _MatrixHelper; /** * Get character width depending on font type. * * @private * @param {number} width - raw width value * @param {_FontStructure} currentFont - font structure * @returns {number} advanced width */ _getCharacterWidth(width: number, currentFont: _FontStructure): number; /** * Move to new line using current leading. * * @private * @param {_TextState} textState - current text state * @returns {void} nothing */ _setNewLineWithLeading(textState: _TextState): void; /** * Set text matrix and text line matrix from operand array. * * @private * @param {string[]} element - matrix operands [a,b,c,d,e,f] * @param {_TextState} textState - current text state * @returns {void} nothing */ _setTextMatrix(element: string[], textState: _TextState): void; /** * Initialize text matrices to identity. * * @private * @param {_TextState} textState - current text state * @param {number[]} identityMatrix - identity matrix values * @returns {void} nothing */ _beginText(textState: _TextState, identityMatrix: number[]): void; /** * Set font name and size from operands. * * @private * @param {string[]} element - font operands * @param {_TextState} textState - current text state * @returns {void} nothing */ _setFont(element: string[], textState: _TextState): void; /** * Move text placement and set leading. * * @private * @param {string[]} element - operands [tx, ty] * @param {_TextState} textState - current text state * @returns {void} nothing */ _moveTextPlacementAndSetLeading(element: string[], textState: _TextState): void; /** * Set text rise value. * * @private * @param {string[]} element - operand array * @param {_TextState} textState - current text state * @returns {void} nothing */ _setTextRise(element: string[], textState: _TextState): void; /** * Set character spacing. * * @private * @param {string[]} element - operand array * @param {_TextState} textState - current text stat * @returns {void} nothing */ _setCharSpacing(element: string[], textState: _TextState): void; /** * Set word spacing. * * @private * @param {string[]} element - operand array * @param {_TextState} textState - current text state * @returns {void} nothing */ _setWordSpacing(element: string[], textState: _TextState): void; /** * Set horizontal text scale. * * @private * @param {string[]} element - operand array * @param {_TextState} textState - current text state * @returns {void} nothing */ _setTextHorizontalScale(element: string[], textState: _TextState): void; /** * Update text leading. * * @private * @param {string[]} element - operand array * @param {_TextState} textState - current text state * @returns {void} nothing */ _updateTextLeading(element: string[], textState: _TextState): void; /** * Move text placement by operands. * * @private * @param {string[]} element - operands [tx, ty] * @param {_TextState} textState - current text state * @returns {void} nothing */ _moveTextPlacement(element: string[], textState: _TextState): void; /** * Compute current transformation matrix for glyph placement. * * @private * @param {_FontStructure} font - current font * @param {number[]} fontMatrix - font matrix values * @param {_TextState} textState - current text state * @returns {number[]} transform matrix [a,b,c,d,e,f] */ _getCurrentTransform(font: _FontStructure, fontMatrix: number[], textState: _TextState): number[]; /** * Determine whether a coordinate intersects any redaction region. * * @private * @param {number} x - x coordinate * @param {number} y - y coordinate * @param {PdfPage} page - page reference * @param {PdfRedactionRegion[]} redactBounds - redaction regions * @returns {boolean} true when coordinate intersects a redaction region */ _isFoundText(x: number, y: number, page: PdfPage, redactBounds: PdfRedactionRegion[]): boolean; /** * Convert page-space coordinates according to page rotation. * * @private * @param {number} x - x coordinate * @param {number} y - y coordinate * @param {PdfPage} page - page reference * @returns {number[]} rotated location [x,y] */ _getRelativeLocation(x: number, y: number, page: PdfPage): number[]; /** * Multiply two affine transform matrices. * * @private * @param {number[]} m1 - left matrix * @param {number[]} m2 - right matrix * @returns {number[]} product matrix */ _transform(m1: number[], m2: number[]): number[]; /** * Get crop or media box values for page coordinate adjustments. * * @private * @param {PdfPage} page - page reference * @returns {number[]} [x0, y0, height] crop or media box values */ _getCropOrMediaBox(page: PdfPage): number[]; /** * Split encoded text tokens into decoded pieces for processing. * * @private * @param {string} encodedText - raw encoded token * @param {_FontStructure} font - current font structure * @param {string[]} inputText - tokenized input text array * @param {boolean} [isForRedaction=false] - include inputType for redaction * @returns {{decodedList: string[], inputType?: string[]}} decoded segments (and optional inputType) */ _getSplitText(encodedText: string, font: _FontStructure, inputText: string[], isForRedaction?: boolean): { decodedList: string[]; inputType?: string[]; }; /** * Compute page-rotation from current text matrix. * * @private * @param {_TextState} textState - current text state * @returns {number} rotation in degrees (0, 90, 270) */ _getPageRotation(textState: _TextState): number; /** * Split a hex string into chunks for glyph decoding. * * @private * @param {string} hexString - hex literal string (e.g. <....>) * @returns {string[]} array of hex chunks */ _splitHexString(hexString: string): string[]; /** * Create a fallback font dictionary used when font lookup fails. * * @private * @param {_PdfCrossReference} crossReference - cross-reference table * @returns {_PdfDictionary} fallback font dictionary */ _getFallBackFontDictionary(crossReference: _PdfCrossReference): _PdfDictionary; /** * Process basic graphics/text commands affecting graphic state. * * @private * @param {string} token - command token (e.g. 'q', 'Q', 'cm') * @param {string[]} element - operand array * @param {_GraphicState} state - current graphic state * @returns {void} nothing */ _processCommand(token: string, element: string[], state: _GraphicState): void; /** * Resolve the current font structure from a font collection or fallback. * * @private * @param {Map} fontCollection - page font resources * @param {_TextState} textState - current text state * @param {_PdfCrossReference} crossReference - cross-reference table * @returns {_FontStructure} resolved font structure */ _getTextFont(fontCollection: Map, textState: _TextState, crossReference: _PdfCrossReference): _FontStructure; /** * Build text content item(s) for a text token (glyphs, bounds, encoded text). * * @private * @param {_FontStructure} currentFont - resolved font * @param {string} text - input text token * @param {number} extraSpacing - extra spacing to apply * @param {_TextState} textState - current text state * @param {PdfPage} page - page reference * @param {string} tempString - temporary accumulator string * @param {{x:number,y:number,width:number,height:number}} previousRect - previous bounding rect * @param {string} extractedText - accumulated extracted text * @param {_PdfContentParserHelper} [parser] - optional content parser helper * @param {TextGlyph[]} [textGlyphs] - optional output glyph array * @param {string[]} [hex] - optional hex chunks array * @param {number} [index] - optional start index for encodedText * @param {string[]} [encodedText] - optional encoded text output * @returns {any} glyph/text data or parser results depending on call (object) */ _getTextContentItem(currentFont: _FontStructure, text: string, extraSpacing: number, textState: _TextState, page: PdfPage, tempString: string, previousRect: { x: number; y: number; width: number; height: number; }, extractedText: string, parser?: _PdfContentParserHelper, textGlyphs?: TextGlyph[], hex?: string[], index?: number, encodedText?: string[]): any; }