///
import { CrossReference, PDFObject, DictionaryObject } from '../pdfdom';
import { MachineState, MachineCallback } from './machine';
export declare class IMAGEDATA extends MachineState {
protected value: any[];
rules: [RegExp, MachineCallback][];
captureGroup(matchValue: RegExpMatchArray): string;
pop(): string;
}
export interface ContentStreamOperation {
operands: any[];
operator: string;
alias?: string;
}
export declare class CONTENT_STREAM extends MachineState {
protected value: ContentStreamOperation[];
private stack;
rules: [RegExp, MachineCallback][];
captureOperator(matchValue: RegExpMatchArray): ContentStreamOperation[];
captureImageData(matchValue: RegExpMatchArray): ContentStreamOperation[];
captureHex(matchValue: RegExpMatchArray): ContentStreamOperation[];
captureDictionary(matchValue: RegExpMatchArray): ContentStreamOperation[];
captureArray(matchValue: RegExpMatchArray): ContentStreamOperation[];
captureBytestring(matchValue: RegExpMatchArray): ContentStreamOperation[];
captureName(matchValue: RegExpMatchArray): ContentStreamOperation[];
captureBoolean(matchValue: RegExpMatchArray): ContentStreamOperation[];
captureFloat(matchValue: RegExpMatchArray): ContentStreamOperation[];
captureInt(matchValue: RegExpMatchArray): ContentStreamOperation[];
}
export declare class ARRAY extends MachineState {
protected value: PDFObject[];
rules: [RegExp, MachineCallback][];
captureObject(matchValue: RegExpMatchArray): PDFObject[];
}
export declare class DICTIONARY extends MachineState {
protected value: DictionaryObject;
rules: [RegExp, MachineCallback][];
captureName(matchValue: RegExpMatchArray): DictionaryObject;
/**
We cannot read the actual stream until we know how long it is, and Length
might be an object reference. But we can't just stop reading, since an
indirect object parser wouldn't ever reach the 'endobj' marker. So we hack in
the PDF, so that we can call pdf._resolveObject on the object reference.
*/
popStream(matchValue: RegExpMatchArray): DictionaryObject;
}
export declare class INDIRECT_OBJECT_VALUE extends MachineState {
rules: [RegExp, MachineCallback][];
captureValue(matchValue: RegExpMatchArray): PDFObject;
}
export declare class OBJECT extends MachineState {
rules: [RegExp, MachineCallback][];
captureHexstring(matchValue: RegExpMatchArray): Buffer;
captureDictionary(matchValue: RegExpMatchArray): DictionaryObject;
captureArray(matchValue: RegExpMatchArray): PDFObject[];
captureBytestring(matchValue: RegExpMatchArray): Buffer;
captureReference(matchValue: RegExpMatchArray): {
object_number: number;
generation_number: number;
};
captureIndirectObject(matchValue: RegExpMatchArray): {
object_number: number;
generation_number: number;
value: PDFObject;
};
captureName(matchValue: RegExpMatchArray): string;
captureTrue(matchValue: RegExpMatchArray): boolean;
captureFalse(matchValue: RegExpMatchArray): boolean;
captureNull(matchValue: RegExpMatchArray): any;
captureFloat(matchValue: RegExpMatchArray): number;
captureInt(matchValue: RegExpMatchArray): number;
}
export interface XrefWithTrailer {
cross_references?: CrossReference[];
trailer?: DictionaryObject;
startxref?: number;
}
/**
xref
0 215
0000000001 65535 f
0000286441 00000 n
trailer
<<
/Size 215
/Root 213 0 R
/Info 214 0 R
/ID [<01AAC31795631BB8E5C22F89D057CFE5> <01AAC31795631BB8E5C22F89D057CFE5>]
>>
startxref
286801
%%EOF
*/
export declare class XREF_WITH_TRAILER extends MachineState {
protected value: XrefWithTrailer;
rules: [RegExp, MachineCallback][];
captureXref(matchValue: RegExpMatchArray): XrefWithTrailer;
captureTrailer(matchValue: RegExpMatchArray): XrefWithTrailer;
captureStartXref(matchValue: RegExpMatchArray): XrefWithTrailer;
captureIndirectObject(matchValue: RegExpMatchArray): XrefWithTrailer;
}
export declare class STARTXREF extends MachineState {
rules: [RegExp, MachineCallback][];
captureStartXref(matchValue: RegExpMatchArray): number;
}
/**
the header line of an XREF consists of the starting object number of
the cross references in the following XREF section, followed by a space,
followed by the number of cross references in that section, following by
a universal newline
*/
export declare class XREF extends MachineState {
protected value: CrossReference[];
rules: [RegExp, MachineCallback][];
captureSection(matchValue: RegExpMatchArray): CrossReference[];
}
export interface PartialCrossReference {
generation_number: number;
in_use: boolean;
offset?: number;
object_stream_object_number?: number;
object_stream_index?: number;
}
export declare class XREF_REFERENCE extends MachineState {
rules: [RegExp, MachineCallback<{
offset: number;
generation_number: number;
in_use: boolean;
}>][];
capture(matchValue: RegExpMatchArray): {
offset: number;
generation_number: number;
in_use: boolean;
};
}
export declare class STREAM extends MachineState {
rules: [RegExp, MachineCallback][];
/**
From PDF32000_2008.pdf:7.3.8
> The sequence of bytes that make up a stream lie between the end-of-line marker following the stream keyword and the endstream keyword; the stream dictionary specifies the exact number of bytes.
*/
consumeBytes(length: number): void;
}
/**
A CMap's maps from character codes (or character code sequences) to
UTF-16BE-encoded Unicode character strings.
*/
export interface CharRange {
low: number;
high: number;
}
export declare class CODESPACERANGE extends MachineState {
protected value: CharRange[];
private stack;
rules: [RegExp, MachineCallback][];
captureHexstring(matchValue: RegExpMatchArray): CharRange[];
popStack(matchValue: RegExpMatchArray): CharRange[];
}
export interface CharMapping {
src: number;
dst: string;
byteLength: number;
}
/**
not sure how to parse a bfchar like this one:
<0411><5168 fffd (fffd is repeated 32 times in total)>
String.fromCharCode(parseInt('D840', 16), parseInt('DC3E', 16))
*/
export declare class BFCHAR extends MachineState {
protected value: CharMapping[];
private stack;
rules: [RegExp, MachineCallback][];
captureHexstring(matchValue: RegExpMatchArray): CharMapping[];
popStack(matchValue: RegExpMatchArray): CharMapping[];
}
/**
the typical BFRANGE looks like "<0000> <005E> <0020>"
which means map 0000 -> 0020, 0001 -> 0021, 0002 -> 0022, and so on, up to 005E -> 007E
the other kind of BFRANGE looks like "<005F> <0061> [<00660066> <00660069> <00660066006C>]"
which means map 005F -> 00660066, 0060 -> 00660069, and 0061 -> 00660066006C
*/
export declare class BFRANGE extends MachineState {
protected value: CharMapping[];
private stack;
rules: [RegExp, MachineCallback][];
captureHexstring(matchValue: RegExpMatchArray): CharMapping[];
captureArray(matchValue: RegExpMatchArray): CharMapping[];
popStack(matchValue: RegExpMatchArray): CharMapping[];
}
/**
Holds a mapping from in-PDF character codes to native Javascript Unicode strings.
Critical pair: P13-1145.pdf (byteLength: 2) vs. P13-4012.pdf (byteLength: 1)
*/
export interface CMap {
codeSpaceRanges: CharRange[];
mappings: CharMapping[];
byteLength: number;
}
export declare class CMAP extends MachineState {
private codeSpaceRanges;
private mappings;
rules: [RegExp, MachineCallback][];
captureCodeSpaceRange(matchValue: RegExpMatchArray): CMap;
captureBFChar(matchValue: RegExpMatchArray): CMap;
captureBFRange(matchValue: RegExpMatchArray): CMap;
pop(): CMap;
}