UNPKG

@syncfusion/ej2-pdf

Version:

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

132 lines (131 loc) 5.79 kB
/** * Convert a buffer to an integer. * * @private * @param {Uint8Array} input - The input buffer as a Uint8Array. * @returns {number} The integer value. */ export declare function _bufferToInteger(input: Uint8Array): number; /** * Converts an integer into a buffer (Uint8Array) representation. * * @private * @param {number} int - The integer to convert to a Uint8Array. * @returns {Uint8Array} A Uint8Array representing the integer in its encoded form. * @throws {Error} Throws an error if the integer is out of range for 32-bit encoding without BigInt. */ export declare function _integerToBuffer(int: number): Uint8Array; /** * Decodes a signed big-endian integer from a Uint8Array. * * @private * @param {Uint8Array} value - The byte array representing the signed integer in big-endian format. * @returns {number} The decoded signed integer. * @throws {Error} Throws an error if the byte array is longer than 4 bytes */ export declare function _decodeSignedBigEndianInteger(value: Uint8Array): number; /** * Decodes an unsigned big-endian integer from a Uint8Array. * * @private * @param {Uint8Array} value - The byte array representing the unsigned integer in big-endian format. * @returns {number} The decoded unsigned integer. * @throws {Error} Throws an error if the byte array is longer than 4 bytes, which cannot be decoded. */ export declare function _decodeUnsignedBigEndianInteger(value: Uint8Array): number; /** * Dissects a floating-point number into its sign, exponent, and mantissa components. * * @private * @param {number} value - The floating-point number to dissect. * @returns {{ negative: boolean, exponent: number, mantissa: number }} An object. */ export declare function _dissectFloat(value: number): { negative: boolean; exponent: number; mantissa: number; }; /** * Encodes a signed 32-bit integer to a big-endian Uint8Array. * * @private * @param {number} value - The signed integer to encode. Must be within the range -2147483648 to 2147483647. * @returns {Uint8Array} A Uint8Array representing the number in big-endian format. * @throws {Error} Throws an error if the number is outside the valid 32-bit signed integer range. */ export declare function _encodeBigEndianSignedInteger(value: number): Uint8Array; /** * Encodes an unsigned 32-bit integer into a big-endian Uint8Array. * * @private * @param {number} value - The unsigned integer to encode. Must be within the range 0 to 4294967295. * @returns {Uint8Array} A Uint8Array representing the number in big-endian format. * @throws {Error} Throws an error if the number is outside the valid 32-bit unsigned integer range. */ export declare function _encodeUnsignedBigEndianInteger(value: number): Uint8Array; /** * Encodes a floating-point number into an X690 binary real number format (as a Uint8Array). * * @private * @param {number} value - The floating-point number to encode. * @returns {Uint8Array} A Uint8Array representing the encoded X690 binary real number. * @throws {Error} Throws an error if the number is too precise to encode. */ export declare function _encodeX690BinaryRealNumber(value: number): Uint8Array; /** * Retrieves the value of a specific bit from a Uint8Array. * * @private * @param {Uint8Array} from - The Uint8Array from which the bit value is extracted. * @param {number} bitIndex - The index of the bit to retrieve (0-indexed). * @returns {boolean} `true` if the bit is set (1), otherwise `false`. */ export declare function _getBit(from: Uint8Array, bitIndex: number): boolean; /** * Packs a Uint8ClampedArray of bits into a Uint8Array of bytes. * * @private * @param {Uint8ClampedArray} bits - The array of bits to be packed. Each bit should be 0 or 1. * @returns {Uint8Array} A Uint8Array representing the packed bits into bytes. */ export declare function _packBits(bits: Uint8ClampedArray): Uint8Array; /** * Sets or clears a bit at a specific index in a Uint8Array. * * @private * @param {Uint8Array} to - The Uint8Array into which the bit will be set or cleared. * @param {number} bitIndex - The index of the bit to set or clear, 0-indexed. * @param {boolean} value - A boolean indicating whether to set (true) or clear (false) the bit. * @returns {void} This function does not return a value. */ export declare function _setBit(to: Uint8Array, bitIndex: number, value: boolean): void; /** * Sets or clears a bit at a specific index in a Uint8Array for Base-256 encoding. * * @private * @param {Uint8Array} to - The Uint8Array into which the bit will be set or cleared. * @param {number} bitIndex - The index of the bit to set or clear, 0-indexed. * @param {boolean} value - A boolean indicating whether to set (true) or clear (false) the bit. * @returns {void} This function does not return a value. */ export declare function _setBitInBase256(to: Uint8Array, bitIndex: number, value: boolean): void; /** * Decodes a Uint8Array to a string using the specified text encoding. * * @private * @param {Uint8Array} bytes - The byte array to decode into a string. * @param {string} [encoding ='utf-8'] - The text encoding to use for decoding. Defaults to 'utf-8'. * @returns {string} The decoded string. * @throws {Error} Throws an error if `TextDecoder` is not available. */ export declare function _convertBytesToText(bytes: Uint8Array, encoding?: string): string; /** * Checks whether a given Uint8Array is BER-encoded. * * BER (Basic Encoding Rules) encoding for a sequence starts with the bytes 0x30 0x80 * * @private * @param {Uint8Array} input - The input byte array to check. * @returns {boolean} True if the input starts with BER indefinite-length encoding; otherwise, false. */ export declare function _isBasicEncodingElement(input: Uint8Array): boolean;