import { ReferencePointer } from './parser'; /** * 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 VERSION: number[]; static NULL: number[]; static DOT: number; static CR: number; static LF: number; static TYPE: string; static SPACE: number; static OBJ: number[]; static ENDOBJ: number[]; static ARRAY_START: number[]; static ARRAY_END: number[]; static LITERAL_STRING_START: number[]; static HEX_STRING_START: number[]; static LITERAL_STRING_END: number[]; static HEX_STRING_END: number[]; static R: number[]; static ANNOTS: number[]; static DICT_START: number[]; static DICT_END: number[]; static PAGE: number[]; static SIZE: number[]; static ROOT: number[]; static PREV: number[]; static STARTXREF: number[]; static XREF: number[]; static STREAM: number[]; static 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 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 * /