import { ReferencePointer } from './parser'; import { Color } from './annotations/annotation_types'; /** * The result contains the extraction result and the * end_index always points to the last position that describes the extracted result. * * NOT ONE POSITION AHEAD AND NO TRAILING SPACES. * */ export interface ExtractionResult { result: any; start_index: number; end_index: number; } export interface PDFVersion { major: number; minor: number; } /** * This class provides methods to navigate through the byte array representing the PDF document * */ export declare class Util { static readonly VERSION: number[]; static readonly COMMENT_START: number[]; static readonly NULL: number[]; static readonly DOT: number; static readonly CR: number; static readonly LF: number; static readonly TYPE: string; static readonly SPACE: number; static readonly OBJ: number[]; static readonly ENDOBJ: number[]; static readonly ARRAY_START: number[]; static readonly ARRAY_END: number[]; static readonly LITERAL_STRING_START: number[]; static readonly HEX_STRING_START: number[]; static readonly LITERAL_STRING_END: number[]; static readonly HEX_STRING_END: number[]; static readonly R: number[]; static readonly ANNOTS: number[]; static readonly DICT_START: number[]; static readonly DICT_END: number[]; static readonly PAGE: number[]; static readonly SIZE: number[]; static readonly ROOT: number[]; static readonly PREV: number[]; static readonly STARTXREF: number[]; static readonly XREF: number[]; static readonly STREAM: number[]; static readonly TRAILER: number[]; /** * Extracts the version information of a PDF file * */ static extractVersion(data: Uint8Array, index?: number): PDFVersion; /** * Consumes comments that is * '%.................. EOL' * * Also handles mulitple line comments * */ private static consumeComment; /** * Returns the next word. These are bytes that are not separated by a delimiter and a ptr to the position where the word ends * It ignores/skips comments. * */ static readNextWord(data: Uint8Array, index?: number): ExtractionResult; /** * Assumes that at position index is a delimiter and than runs as long forward until it finds * another delimiter or reaches the end of the document * */ static skipDelimiter(data: Uint8Array, index?: number): number; /** * Skips only spaces * */ static skipSpaces(data: Uint8Array | number[], index?: number): number; /** * Skips the symbol specified by _symbol * */ static skipSymbol(data: Uint8Array | number[], _symbol: number, index?: number): number; /** * Skips only spaces * */ static skipSpacesReverse(data: Uint8Array | number[], index?: number): number; /** * Assumes that at position index is a delimiter and than runs as long backwards until it finds * another delimiter or reaches the end of the document * */ static skipDelimiterReverse(data: Uint8Array, index?: number): number; /** * Transforms a string into an array of the corresponding ascii values * */ static convertStringToAscii(toConvert: string): number[]; static isSpace(value: number): boolean; static isDelimiter(value: number): boolean; static isNumber(value: number): boolean; /** * Search the sequence in data starting at the offset * * Set the 'closed' flag to check if the suceeding char after the sequence is a line feed (10), a carriage return (13), the end * of the whole sequence or a space (32) * */ static locateSequence(sequence: number[], data: Uint8Array, offset?: number, closed?: boolean): number; /** * Search the sequence in data starting at the offset in reverse direction * * Set the 'closed' flag to check if the preceding char before the sequence is a line feed (10), a carriage return (13), the start * of the whole data sequence or a space (32) * */ static locateSequenceReversed(sequence: number[], data: Uint8Array, offset?: number, closed?: boolean): number; /** * Locates the index before the next delimiter. Delimiters can be a line feed (10), a carriage return (13), the end of the whole sequence * or a space (32) * */ static locateDelimiter(data: Uint8Array, offset?: number): number; /** * Locates the index after the last delimiter. Delimiters can be a line feed (10), a carriage return (13), the end of the whole sequence * or a space (32) * */ static locateDelimiterReversed(data: Uint8Array, offset?: number): number; /** * Extract an object identifier * obj * */ static extractObjectId(data: Uint8Array, index: number): ReferencePointer; /** * Extract the reference starting at position 'index' * */ static extractReference(data: Uint8Array, index: number): Uint8Array; /** * Returns a reference as typed object * */ static extractReferenceTyped(data: Uint8Array, index: number): ExtractionResult; /** * Extracts a string in Hex notation <...> * */ static extractHexString(data: Uint8Array, index: number): ExtractionResult; /** * Extratcs a string (...) * */ static extractString(data: Uint8Array, index: number): ExtractionResult; /** * Returns the value of an option * /