/// export interface List { [index: number]: T; length: number; } export interface DecodeParms { Predictor?: number; Colors?: number; BitsPerComponent?: number; Columns?: number; EarlyChange?: number; } /** `ascii` is a buffer in base-85 encoding. The output is a buffer that is 4/5 as long. All values are in the range 0x21-0x75 == 33-117 == '!'-'u' and 0x7A == 122 == 'z' 0x7E,0x3E == 126,62 == '~>' serves as the EOF marker While decoding, all whitespace should be ignored. Any other invalid characters should produce an error. http://en.wikipedia.org/wiki/Ascii85 is helpful, as well as PDF32000_2008.pdf:7.4.3 TODO: throw when encountering a 'z' inside a group (or any other out-of-range character) throw when a final group contains only one character */ export declare function ASCII85Decode(ascii: Buffer): Buffer; /** > The ASCIIHexDecode filter shall produce one byte of binary data for each pair of ASCII hexadecimal digits (0–9 and A–F or a–f). All white-space characters (see 7.2, "Lexical Conventions") shall be ignored. A GREATER-THAN SIGN (3Eh) indicates EOD. Any other characters shall cause an error. If the filter encounters the EOD marker after reading an odd number of hexadecimal digits, it shall behave as if a 0 (zero) followed the last digit. */ export declare function ASCIIHexDecode(ascii: List): Buffer; export declare function FlateDecode(buffer: Buffer, decodeParms: DecodeParms): Buffer; export declare class BitIterator { /** Internal binary representation from which we read bit strings */ private buffer; /** The number of bits from the front of the buffer */ offset: number; /** The total number of bits available in buffer */ length: number; constructor(buffer: Buffer); /** Read the next `n` bits from the underlying buffer, but do not advance the offset. */ peek(n: number): number; /** Read the next `n` bits from the underlying buffer and advance the offset by `n`. */ next(n: number): number; } /** Data encoded using the LZW compression method shall consist of a sequence of codes that are 9 to 12 bits long. Each code shall represent: * a single character of input data (0–255) * a clear-table marker (256) * an EOD marker (257) * a table entry representing a multiple-character sequence that has been encountered previously in the input (258 or greater). Initially, the code length shall be 9 bits and the LZW table shall contain only entries for the 258 fixed codes. As encoding proceeds, entries shall be appended to the table, associating new codes with longer and longer sequences of input characters. The encoder and the decoder shall maintain identical copies of this table. Whenever both the encoder and the decoder independently (but synchronously) realize that the current code length is no longer sufficient to represent the number of entries in the table, they shall increase the number of bits per code by 1. The first output code that is 10 bits long shall be the one following the creation of table entry 511, and similarly for 11 (1023) and 12 (2047) bits. Codes shall never be longer than 12 bits; therefore, entry 4095 is the last entry of the LZW table. The encoder shall execute the following sequence of steps to generate each output code: a) Accumulate a sequence of one or more input characters matching a sequence already present in the table. For maximum compression, the encoder looks for the longest such sequence. b) Emit the code corresponding to that sequence. c) Create a new table entry for the first unused code. Its value is the sequence found in step (a) followed by the next input character. From Wikipedia's http://en.wikipedia.org/wiki/Lempel-Ziv-Welch: > In order to rebuild the dictionary in the same way as it was built during encoding, it also obtains the next value from the input and adds to the dictionary the concatenation of the current string and the first character of the string obtained by decoding the next input value, or THE FIRST CHARACTER OF THE STRING JUST OUTPUT IF THE NEXT VALUE CAN NOT BE DECODED (If the next value is unknown to the decoder, then it must be the value that will be added to the dictionary this iteration, and so its first character must be the same as the first character of the current string being sent to decoded output). The decoder then proceeds to the next input value (which was already read in as the "next value" in the previous pass) and repeats the process until there is no more input, at which point the final input value is decoded without any more additions to the dictionary. */ export declare function LZWDecode(buffer: Buffer): Buffer; export declare function applyFilters(buffer: Buffer, filters: string[], decodeParmss?: any[]): Buffer;