first commit

This commit is contained in:
Ale
2025-05-13 12:01:17 +02:00
commit d7881a4461
4852 changed files with 537159 additions and 0 deletions

84
node_modules/pdf-lib/ts3.4/es/core/PDFContext.d.ts generated vendored Normal file
View File

@@ -0,0 +1,84 @@
import PDFHeader from "./document/PDFHeader";
import PDFArray from "./objects/PDFArray";
import PDFBool from "./objects/PDFBool";
import PDFDict from "./objects/PDFDict";
import PDFHexString from "./objects/PDFHexString";
import PDFName from "./objects/PDFName";
import PDFNull from "./objects/PDFNull";
import PDFNumber from "./objects/PDFNumber";
import PDFObject from "./objects/PDFObject";
import PDFRawStream from "./objects/PDFRawStream";
import PDFRef from "./objects/PDFRef";
import PDFStream from "./objects/PDFStream";
import PDFString from "./objects/PDFString";
import PDFOperator from "./operators/PDFOperator";
import PDFContentStream from "./structures/PDFContentStream";
import { SimpleRNG } from "../utils/rng";
declare type LookupKey = PDFRef | PDFObject | undefined;
interface LiteralObject {
[name: string]: Literal | PDFObject;
}
interface LiteralArray {
[index: number]: Literal | PDFObject;
}
declare type Literal = LiteralObject | LiteralArray | string | number | boolean | null | undefined;
declare class PDFContext {
static create: () => PDFContext;
largestObjectNumber: number;
header: PDFHeader;
trailerInfo: {
Root?: PDFObject;
Encrypt?: PDFObject;
Info?: PDFObject;
ID?: PDFObject;
};
rng: SimpleRNG;
private readonly indirectObjects;
private pushGraphicsStateContentStreamRef?;
private popGraphicsStateContentStreamRef?;
private constructor();
assign(ref: PDFRef, object: PDFObject): void;
nextRef(): PDFRef;
register(object: PDFObject): PDFRef;
delete(ref: PDFRef): boolean;
lookupMaybe(ref: LookupKey, type: typeof PDFArray): PDFArray | undefined;
lookupMaybe(ref: LookupKey, type: typeof PDFBool): PDFBool | undefined;
lookupMaybe(ref: LookupKey, type: typeof PDFDict): PDFDict | undefined;
lookupMaybe(ref: LookupKey, type: typeof PDFHexString): PDFHexString | undefined;
lookupMaybe(ref: LookupKey, type: typeof PDFName): PDFName | undefined;
lookupMaybe(ref: LookupKey, type: typeof PDFNull): typeof PDFNull | undefined;
lookupMaybe(ref: LookupKey, type: typeof PDFNumber): PDFNumber | undefined;
lookupMaybe(ref: LookupKey, type: typeof PDFStream): PDFStream | undefined;
lookupMaybe(ref: LookupKey, type: typeof PDFRef): PDFRef | undefined;
lookupMaybe(ref: LookupKey, type: typeof PDFString): PDFString | undefined;
lookupMaybe(ref: LookupKey, type1: typeof PDFString, type2: typeof PDFHexString): PDFString | PDFHexString | undefined;
lookup(ref: LookupKey): PDFObject | undefined;
lookup(ref: LookupKey, type: typeof PDFArray): PDFArray;
lookup(ref: LookupKey, type: typeof PDFBool): PDFBool;
lookup(ref: LookupKey, type: typeof PDFDict): PDFDict;
lookup(ref: LookupKey, type: typeof PDFHexString): PDFHexString;
lookup(ref: LookupKey, type: typeof PDFName): PDFName;
lookup(ref: LookupKey, type: typeof PDFNull): typeof PDFNull;
lookup(ref: LookupKey, type: typeof PDFNumber): PDFNumber;
lookup(ref: LookupKey, type: typeof PDFStream): PDFStream;
lookup(ref: LookupKey, type: typeof PDFRef): PDFRef;
lookup(ref: LookupKey, type: typeof PDFString): PDFString;
lookup(ref: LookupKey, type1: typeof PDFString, type2: typeof PDFHexString): PDFString | PDFHexString;
getObjectRef(pdfObject: PDFObject): PDFRef | undefined;
enumerateIndirectObjects(): [PDFRef, PDFObject][];
obj(literal: null | undefined): typeof PDFNull;
obj(literal: string): PDFName;
obj(literal: number): PDFNumber;
obj(literal: boolean): PDFBool;
obj(literal: LiteralObject): PDFDict;
obj(literal: LiteralArray): PDFArray;
stream(contents: string | Uint8Array, dict?: LiteralObject): PDFRawStream;
flateStream(contents: string | Uint8Array, dict?: LiteralObject): PDFRawStream;
contentStream(operators: PDFOperator[], dict?: LiteralObject): PDFContentStream;
formXObject(operators: PDFOperator[], dict?: LiteralObject): PDFContentStream;
getPushGraphicsStateContentStream(): PDFRef;
getPopGraphicsStateContentStream(): PDFRef;
addRandomSuffix(prefix: string, suffixLength?: number): string;
}
export default PDFContext;
//# sourceMappingURL=PDFContext.d.ts.map

View File

@@ -0,0 +1,38 @@
import PDFObject from "./objects/PDFObject";
import PDFContext from "./PDFContext";
/**
* PDFObjectCopier copies PDFObjects from a src context to a dest context.
* The primary use case for this is to copy pages between PDFs.
*
* _Copying_ an object with a PDFObjectCopier is different from _cloning_ an
* object with its [[PDFObject.clone]] method:
*
* ```
* const src: PDFContext = ...
* const dest: PDFContext = ...
* const originalObject: PDFObject = ...
* const copiedObject = PDFObjectCopier.for(src, dest).copy(originalObject);
* const clonedObject = originalObject.clone();
* ```
*
* Copying an object is equivalent to cloning it and then copying over any other
* objects that it references. Note that only dictionaries, arrays, and streams
* (or structures build from them) can contain indirect references to other
* objects. Copying a PDFObject that is not a dictionary, array, or stream is
* supported, but is equivalent to cloning it.
*/
declare class PDFObjectCopier {
static for: (src: PDFContext, dest: PDFContext) => PDFObjectCopier;
private readonly src;
private readonly dest;
private readonly traversedObjects;
private constructor();
copy: <T extends PDFObject>(object: T) => T;
private copyPDFPage;
private copyPDFDict;
private copyPDFArray;
private copyPDFStream;
private copyPDFIndirectObject;
}
export default PDFObjectCopier;
//# sourceMappingURL=PDFObjectCopier.d.ts.map

View File

@@ -0,0 +1,22 @@
import PDFObject from "../objects/PDFObject";
import PDFString from "../objects/PDFString";
import PDFHexString from "../objects/PDFHexString";
import PDFArray from "../objects/PDFArray";
import PDFName from "../objects/PDFName";
import PDFRef from "../objects/PDFRef";
import PDFAcroTerminal from "./PDFAcroTerminal";
declare class PDFAcroButton extends PDFAcroTerminal {
Opt(): PDFString | PDFHexString | PDFArray | undefined;
setOpt(opt: PDFObject[]): void;
getExportValues(): (PDFString | PDFHexString)[] | undefined;
removeExportValue(idx: number): void;
normalizeExportValues(): void;
/**
* Reuses existing opt if one exists with the same value (assuming
* `useExistingIdx` is `true`). Returns index of existing (or new) opt.
*/
addOpt(opt: PDFHexString | PDFString, useExistingOptIdx: boolean): number;
addWidgetWithOpt(widget: PDFRef, opt: PDFHexString | PDFString, useExistingOptIdx: boolean): PDFName;
}
export default PDFAcroButton;
//# sourceMappingURL=PDFAcroButton.d.ts.map

View File

@@ -0,0 +1,14 @@
import PDFContext from "../PDFContext";
import PDFRef from "../objects/PDFRef";
import PDFDict from "../objects/PDFDict";
import PDFName from "../objects/PDFName";
import PDFAcroButton from "./PDFAcroButton";
declare class PDFAcroCheckBox extends PDFAcroButton {
static fromDict: (dict: PDFDict, ref: PDFRef) => PDFAcroCheckBox;
static create: (context: PDFContext) => PDFAcroCheckBox;
setValue(value: PDFName): void;
getValue(): PDFName;
getOnValue(): PDFName | undefined;
}
export default PDFAcroCheckBox;
//# sourceMappingURL=PDFAcroCheckBox.d.ts.map

View File

@@ -0,0 +1,21 @@
import PDFAcroTerminal from "./PDFAcroTerminal";
import PDFHexString from "../objects/PDFHexString";
import PDFString from "../objects/PDFString";
import PDFArray from "../objects/PDFArray";
declare class PDFAcroChoice extends PDFAcroTerminal {
setValues(values: (PDFString | PDFHexString)[]): void;
valuesAreValid(values: (PDFString | PDFHexString)[]): boolean;
updateSelectedIndices(values: (PDFString | PDFHexString)[]): void;
getValues(): (PDFString | PDFHexString)[];
Opt(): PDFArray | PDFString | PDFHexString | undefined;
setOptions(options: {
value: PDFString | PDFHexString;
display?: PDFString | PDFHexString;
}[]): void;
getOptions(): {
value: PDFString | PDFHexString;
display: PDFString | PDFHexString;
}[];
}
export default PDFAcroChoice;
//# sourceMappingURL=PDFAcroChoice.d.ts.map

View File

@@ -0,0 +1,10 @@
import PDFDict from "../objects/PDFDict";
import PDFAcroChoice from "./PDFAcroChoice";
import PDFContext from "../PDFContext";
import PDFRef from "../objects/PDFRef";
declare class PDFAcroComboBox extends PDFAcroChoice {
static fromDict: (dict: PDFDict, ref: PDFRef) => PDFAcroComboBox;
static create: (context: PDFContext) => PDFAcroComboBox;
}
export default PDFAcroComboBox;
//# sourceMappingURL=PDFAcroComboBox.d.ts.map

View File

@@ -0,0 +1,37 @@
import PDFDict from "../objects/PDFDict";
import PDFString from "../objects/PDFString";
import PDFHexString from "../objects/PDFHexString";
import PDFName from "../objects/PDFName";
import PDFObject from "../objects/PDFObject";
import PDFNumber from "../objects/PDFNumber";
import PDFArray from "../objects/PDFArray";
import PDFRef from "../objects/PDFRef";
declare class PDFAcroField {
readonly dict: PDFDict;
readonly ref: PDFRef;
protected constructor(dict: PDFDict, ref: PDFRef);
T(): PDFString | PDFHexString | undefined;
Ff(): PDFNumber | undefined;
V(): PDFObject | undefined;
Kids(): PDFArray | undefined;
DA(): PDFString | PDFHexString | undefined;
setKids(kids: PDFObject[]): void;
getParent(): PDFAcroField | undefined;
setParent(parent: PDFRef | undefined): void;
getFullyQualifiedName(): string | undefined;
getPartialName(): string | undefined;
setPartialName(partialName: string | undefined): void;
setDefaultAppearance(appearance: string): void;
getDefaultAppearance(): string | undefined;
setFontSize(fontSize: number): void;
getFlags(): number;
setFlags(flags: number): void;
hasFlag(flag: number): boolean;
setFlag(flag: number): void;
clearFlag(flag: number): void;
setFlagTo(flag: number, enable: boolean): void;
getInheritableAttribute(name: PDFName): PDFObject | undefined;
ascend(visitor: (node: PDFAcroField) => any): void;
}
export default PDFAcroField;
//# sourceMappingURL=PDFAcroField.d.ts.map

View File

@@ -0,0 +1,21 @@
import PDFContext from "../PDFContext";
import PDFDict from "../objects/PDFDict";
import PDFArray from "../objects/PDFArray";
import PDFRef from "../objects/PDFRef";
import PDFAcroField from "./PDFAcroField";
declare class PDFAcroForm {
readonly dict: PDFDict;
static fromDict: (dict: PDFDict) => PDFAcroForm;
static create: (context: PDFContext) => PDFAcroForm;
private constructor();
Fields(): PDFArray | undefined;
getFields(): [PDFAcroField, PDFRef][];
getAllFields(): [PDFAcroField, PDFRef][];
addField(field: PDFRef): void;
removeField(field: PDFAcroField): void;
normalizedEntries(): {
Fields: PDFArray;
};
}
export default PDFAcroForm;
//# sourceMappingURL=PDFAcroForm.d.ts.map

View File

@@ -0,0 +1,10 @@
import PDFDict from "../objects/PDFDict";
import PDFAcroChoice from "./PDFAcroChoice";
import PDFContext from "../PDFContext";
import PDFRef from "../objects/PDFRef";
declare class PDFAcroListBox extends PDFAcroChoice {
static fromDict: (dict: PDFDict, ref: PDFRef) => PDFAcroListBox;
static create: (context: PDFContext) => PDFAcroListBox;
}
export default PDFAcroListBox;
//# sourceMappingURL=PDFAcroListBox.d.ts.map

View File

@@ -0,0 +1,14 @@
import PDFDict from "../objects/PDFDict";
import PDFRef from "../objects/PDFRef";
import PDFContext from "../PDFContext";
import PDFAcroField from "./PDFAcroField";
declare class PDFAcroNonTerminal extends PDFAcroField {
static fromDict: (dict: PDFDict, ref: PDFRef) => PDFAcroNonTerminal;
static create: (context: PDFContext) => PDFAcroNonTerminal;
addField(field: PDFRef): void;
normalizedEntries(): {
Kids: import("../objects/PDFArray").default;
};
}
export default PDFAcroNonTerminal;
//# sourceMappingURL=PDFAcroNonTerminal.d.ts.map

View File

@@ -0,0 +1,10 @@
import PDFDict from "../objects/PDFDict";
import PDFAcroButton from "./PDFAcroButton";
import PDFContext from "../PDFContext";
import PDFRef from "../objects/PDFRef";
declare class PDFAcroPushButton extends PDFAcroButton {
static fromDict: (dict: PDFDict, ref: PDFRef) => PDFAcroPushButton;
static create: (context: PDFContext) => PDFAcroPushButton;
}
export default PDFAcroPushButton;
//# sourceMappingURL=PDFAcroPushButton.d.ts.map

View File

@@ -0,0 +1,14 @@
import PDFRef from "../objects/PDFRef";
import PDFDict from "../objects/PDFDict";
import PDFName from "../objects/PDFName";
import PDFAcroButton from "./PDFAcroButton";
import PDFContext from "../PDFContext";
declare class PDFAcroRadioButton extends PDFAcroButton {
static fromDict: (dict: PDFDict, ref: PDFRef) => PDFAcroRadioButton;
static create: (context: PDFContext) => PDFAcroRadioButton;
setValue(value: PDFName): void;
getValue(): PDFName;
getOnValues(): PDFName[];
}
export default PDFAcroRadioButton;
//# sourceMappingURL=PDFAcroRadioButton.d.ts.map

View File

@@ -0,0 +1,8 @@
import PDFDict from "../objects/PDFDict";
import PDFRef from "../objects/PDFRef";
import PDFAcroTerminal from "./PDFAcroTerminal";
declare class PDFAcroSignature extends PDFAcroTerminal {
static fromDict: (dict: PDFDict, ref: PDFRef) => PDFAcroSignature;
}
export default PDFAcroSignature;
//# sourceMappingURL=PDFAcroSignature.d.ts.map

View File

@@ -0,0 +1,17 @@
import PDFDict from "../objects/PDFDict";
import PDFName from "../objects/PDFName";
import PDFRef from "../objects/PDFRef";
import PDFAcroField from "./PDFAcroField";
import PDFWidgetAnnotation from "../annotation/PDFWidgetAnnotation";
declare class PDFAcroTerminal extends PDFAcroField {
static fromDict: (dict: PDFDict, ref: PDFRef) => PDFAcroTerminal;
FT(): PDFName;
getWidgets(): PDFWidgetAnnotation[];
addWidget(ref: PDFRef): void;
removeWidget(idx: number): void;
normalizedEntries(): {
Kids: import("../objects/PDFArray").default;
};
}
export default PDFAcroTerminal;
//# sourceMappingURL=PDFAcroTerminal.d.ts.map

View File

@@ -0,0 +1,23 @@
import PDFContext from "../PDFContext";
import PDFDict from "../objects/PDFDict";
import PDFNumber from "../objects/PDFNumber";
import PDFString from "../objects/PDFString";
import PDFHexString from "../objects/PDFHexString";
import PDFRef from "../objects/PDFRef";
import PDFAcroTerminal from "./PDFAcroTerminal";
declare class PDFAcroText extends PDFAcroTerminal {
static fromDict: (dict: PDFDict, ref: PDFRef) => PDFAcroText;
static create: (context: PDFContext) => PDFAcroText;
MaxLen(): PDFNumber | undefined;
Q(): PDFNumber | undefined;
setMaxLength(maxLength: number): void;
removeMaxLength(): void;
getMaxLength(): number | undefined;
setQuadding(quadding: 0 | 1 | 2): void;
getQuadding(): number | undefined;
setValue(value: PDFHexString | PDFString): void;
removeValue(): void;
getValue(): PDFString | PDFHexString | undefined;
}
export default PDFAcroText;
//# sourceMappingURL=PDFAcroText.d.ts.map

142
node_modules/pdf-lib/ts3.4/es/core/acroform/flags.d.ts generated vendored Normal file
View File

@@ -0,0 +1,142 @@
/** From PDF spec table 221 */
export declare enum AcroFieldFlags {
/**
* If set, the user may not change the value of the field. Any associated
* widget annotations will not interact with the user; that is, they will not
* respond to mouse clicks or change their appearance in response to mouse
* motions. This flag is useful for fields whose values are computed or
* imported from a database.
*/
ReadOnly,
/**
* If set, the field shall have a value at the time it is exported by a
* submit-form action (see 12.7.5.2, "Submit-Form Action").
*/
Required,
/**
* If set, the field shall not be exported by a submit-form action
* (see 12.7.5.2, "Submit-Form Action").
*/
NoExport
}
/** From PDF spec table 226 */
export declare enum AcroButtonFlags {
/**
* (Radio buttons only) If set, exactly one radio button shall be selected at
* all times; selecting the currently selected button has no effect. If clear,
* clicking the selected button deselects it, leaving no button selected.
*/
NoToggleToOff,
/**
* If set, the field is a set of radio buttons; if clear, the field is a check
* box. This flag may be set only if the Pushbutton flag is clear.
*/
Radio,
/**
* If set, the field is a pushbutton that does not retain a permanent value.
*/
PushButton,
/**
* If set, a group of radio buttons within a radio button field that use the
* same value for the on state will turn on and off in unison; that is if one
* is checked, they are all checked. If clear, the buttons are mutually
* exclusive (the same behavior as HTML radio buttons).
*/
RadiosInUnison
}
/** From PDF spec table 228 */
export declare enum AcroTextFlags {
/**
* If set, the field may contain multiple lines of text; if clear, the field's
* text shall be restricted to a single line.
*/
Multiline,
/**
* If set, the field is intended for entering a secure password that should
* not be echoed visibly to the screen. Characters typed from the keyboard
* shall instead be echoed in some unreadable form, such as asterisks or
* bullet characters.
* > NOTE To protect password confidentiality, readers should never store
* > the value of the text field in the PDF file if this flag is set.
*/
Password,
/**
* If set, the text entered in the field represents the pathname of a file
* whose contents shall be submitted as the value of the field.
*/
FileSelect,
/**
* If set, text entered in the field shall not be spell-checked.
*/
DoNotSpellCheck,
/**
* If set, the field shall not scroll (horizontally for single-line fields,
* vertically for multiple-line fields) to accommodate more text than fits
* within its annotation rectangle. Once the field is full, no further text
* shall be accepted for interactive form filling; for non-interactive form
* filling, the filler should take care not to add more character than will
* visibly fit in the defined area.
*/
DoNotScroll,
/**
* May be set only if the MaxLen entry is present in the text field dictionary
* (see Table 229) and if the Multiline, Password, and FileSelect flags are
* clear. If set, the field shall be automatically divided into as many
* equally spaced positions, or combs, as the value of MaxLen, and the text
* is laid out into those combs.
*/
Comb,
/**
* If set, the value of this field shall be a rich text string
* (see 12.7.3.4, "Rich Text Strings"). If the field has a value, the RV
* entry of the field dictionary (Table 222) shall specify the rich text
* string.
*/
RichText
}
/** From PDF spec table 230 */
export declare enum AcroChoiceFlags {
/**
* If set, the field is a combo box; if clear, the field is a list box.
*/
Combo,
/**
* If set, the combo box shall include an editable text box as well as a
* drop-down list; if clear, it shall include only a drop-down list. This
* flag shall be used only if the Combo flag is set.
*/
Edit,
/**
* If set, the field's option items shall be sorted alphabetically. This flag
* is intended for use by writers, not by readers. Conforming readers shall
* display the options in the order in which they occur in the Opt array
* (see Table 231).
*/
Sort,
/**
* If set, more than one of the field's option items may be selected
* simultaneously; if clear, at most one item shall be selected.
*/
MultiSelect,
/**
* If set, text entered in the field shall not be spell-checked. This flag
* shall not be used unless the Combo and Edit flags are both set.
*/
DoNotSpellCheck,
/**
* If set, the new value shall be committed as soon as a selection is made
* (commonly with the pointing device). In this case, supplying a value for
* a field involves three actions: selecting the field for fill-in,
* selecting a choice for the fill-in value, and leaving that field, which
* finalizes or "commits" the data choice and triggers any actions associated
* with the entry or changing of this data. If this flag is on, then
* processing does not wait for leaving the field action to occur, but
* immediately proceeds to the third step.
*
* This option enables applications to perform an action once a selection is
* made, without requiring the user to exit the field. If clear, the new
* value is not committed until the user exits the field.
*/
CommitOnSelChange
}
//# sourceMappingURL=flags.d.ts.map

16
node_modules/pdf-lib/ts3.4/es/core/acroform/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
export { default as PDFAcroButton } from "./PDFAcroButton";
export { default as PDFAcroCheckBox } from "./PDFAcroCheckBox";
export { default as PDFAcroChoice } from "./PDFAcroChoice";
export { default as PDFAcroComboBox } from "./PDFAcroComboBox";
export { default as PDFAcroField } from "./PDFAcroField";
export { default as PDFAcroForm } from "./PDFAcroForm";
export { default as PDFAcroListBox } from "./PDFAcroListBox";
export { default as PDFAcroNonTerminal } from "./PDFAcroNonTerminal";
export { default as PDFAcroPushButton } from "./PDFAcroPushButton";
export { default as PDFAcroRadioButton } from "./PDFAcroRadioButton";
export { default as PDFAcroSignature } from "./PDFAcroSignature";
export { default as PDFAcroTerminal } from "./PDFAcroTerminal";
export { default as PDFAcroText } from "./PDFAcroText";
export * from "./flags";
export * from "./utils";
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,7 @@
import PDFDict from "../objects/PDFDict";
import PDFArray from "../objects/PDFArray";
import PDFRef from "../objects/PDFRef";
import PDFAcroField from "./PDFAcroField";
export declare const createPDFAcroFields: (kidDicts?: PDFArray | undefined) => [PDFAcroField, PDFRef][];
export declare const createPDFAcroField: (dict: PDFDict, ref: PDFRef) => PDFAcroField;
//# sourceMappingURL=utils.d.ts.map

View File

@@ -0,0 +1,34 @@
import PDFDict from "../objects/PDFDict";
import PDFNumber from "../objects/PDFNumber";
import PDFArray from "../objects/PDFArray";
import PDFHexString from "../objects/PDFHexString";
import PDFString from "../objects/PDFString";
declare class AppearanceCharacteristics {
readonly dict: PDFDict;
static fromDict: (dict: PDFDict) => AppearanceCharacteristics;
protected constructor(dict: PDFDict);
R(): PDFNumber | undefined;
BC(): PDFArray | undefined;
BG(): PDFArray | undefined;
CA(): PDFHexString | PDFString | undefined;
RC(): PDFHexString | PDFString | undefined;
AC(): PDFHexString | PDFString | undefined;
getRotation(): number | undefined;
getBorderColor(): number[] | undefined;
getBackgroundColor(): number[] | undefined;
getCaptions(): {
normal?: string;
rollover?: string;
down?: string;
};
setRotation(rotation: number): void;
setBorderColor(color: number[]): void;
setBackgroundColor(color: number[]): void;
setCaptions(captions: {
normal: string;
rollover?: string;
down?: string;
}): void;
}
export default AppearanceCharacteristics;
//# sourceMappingURL=AppearanceCharacteristics.d.ts.map

View File

@@ -0,0 +1,12 @@
import PDFDict from "../objects/PDFDict";
import PDFNumber from "../objects/PDFNumber";
declare class BorderStyle {
readonly dict: PDFDict;
static fromDict: (dict: PDFDict) => BorderStyle;
protected constructor(dict: PDFDict);
W(): PDFNumber | undefined;
getWidth(): number | undefined;
setWidth(width: number): void;
}
export default BorderStyle;
//# sourceMappingURL=BorderStyle.d.ts.map

View File

@@ -0,0 +1,52 @@
import PDFDict from "../objects/PDFDict";
import PDFName from "../objects/PDFName";
import PDFStream from "../objects/PDFStream";
import PDFArray from "../objects/PDFArray";
import PDFRef from "../objects/PDFRef";
import PDFNumber from "../objects/PDFNumber";
declare class PDFAnnotation {
readonly dict: PDFDict;
static fromDict: (dict: PDFDict) => PDFAnnotation;
protected constructor(dict: PDFDict);
Rect(): PDFArray | undefined;
AP(): PDFDict | undefined;
F(): PDFNumber | undefined;
getRectangle(): {
x: number;
y: number;
width: number;
height: number;
};
setRectangle(rect: {
x: number;
y: number;
width: number;
height: number;
}): void;
getAppearanceState(): PDFName | undefined;
setAppearanceState(state: PDFName): void;
setAppearances(appearances: PDFDict): void;
ensureAP(): PDFDict;
getNormalAppearance(): PDFRef | PDFDict;
/** @param appearance A PDFDict or PDFStream (direct or ref) */
setNormalAppearance(appearance: PDFRef | PDFDict): void;
/** @param appearance A PDFDict or PDFStream (direct or ref) */
setRolloverAppearance(appearance: PDFRef | PDFDict): void;
/** @param appearance A PDFDict or PDFStream (direct or ref) */
setDownAppearance(appearance: PDFRef | PDFDict): void;
removeRolloverAppearance(): void;
removeDownAppearance(): void;
getAppearances(): {
normal: PDFStream | PDFDict;
rollover?: PDFStream | PDFDict;
down?: PDFStream | PDFDict;
} | undefined;
getFlags(): number;
setFlags(flags: number): void;
hasFlag(flag: number): boolean;
setFlag(flag: number): void;
clearFlag(flag: number): void;
setFlagTo(flag: number, enable: boolean): void;
}
export default PDFAnnotation;
//# sourceMappingURL=PDFAnnotation.d.ts.map

View File

@@ -0,0 +1,27 @@
import PDFDict from "../objects/PDFDict";
import PDFName from "../objects/PDFName";
import PDFRef from "../objects/PDFRef";
import PDFString from "../objects/PDFString";
import PDFHexString from "../objects/PDFHexString";
import PDFContext from "../PDFContext";
import BorderStyle from "./BorderStyle";
import PDFAnnotation from "./PDFAnnotation";
import AppearanceCharacteristics from "./AppearanceCharacteristics";
declare class PDFWidgetAnnotation extends PDFAnnotation {
static fromDict: (dict: PDFDict) => PDFWidgetAnnotation;
static create: (context: PDFContext, parent: PDFRef) => PDFWidgetAnnotation;
MK(): PDFDict | undefined;
BS(): PDFDict | undefined;
DA(): PDFString | PDFHexString | undefined;
P(): PDFRef | undefined;
setP(page: PDFRef): void;
setDefaultAppearance(appearance: string): void;
getDefaultAppearance(): string | undefined;
getAppearanceCharacteristics(): AppearanceCharacteristics | undefined;
getOrCreateAppearanceCharacteristics(): AppearanceCharacteristics;
getBorderStyle(): BorderStyle | undefined;
getOrCreateBorderStyle(): BorderStyle;
getOnValue(): PDFName | undefined;
}
export default PDFWidgetAnnotation;
//# sourceMappingURL=PDFWidgetAnnotation.d.ts.map

View File

@@ -0,0 +1,80 @@
/** From PDF spec table 165 */
export declare enum AnnotationFlags {
/**
* If set, do not display the annotation if it does not belong to one of the
* standard annotation types and no annotation handler is available. If clear,
* display such an unknown annotation using an appearance stream specified by
* its appearance dictionary, if any.
*/
Invisible,
/**
* If set, do not display or print the annotation or allow it to interact with
* the user, regardless of its annotation type or whether an annotation
* handler is available.
*
* In cases where screen space is limited, the ability to hide and show
* annotations selectively can be used in combination with appearance streams
* to display auxiliary pop-up information similar in function to online help
* systems.
*/
Hidden,
/**
* If set, print the annotation when the page is printed. If clear, never
* print the annotation, regardless of whether it is displayed on the screen.
*
* This can be useful for annotations representing interactive pushbuttons,
* which would serve no meaningful purpose on the printed page.
*/
Print,
/**
* If set, do not scale the annotations appearance to match the magnification
* of the page. The location of the annotation on the page (defined by the
* upper-left corner of its annotation rectangle) shall remain fixed,
* regardless of the page magnification.
*/
NoZoom,
/**
* If set, do not rotate the annotations appearance to match the rotation of
* the page. The upper-left corner of the annotation rectangle shall remain in
* a fixed location on the page, regardless of the page rotation.
*/
NoRotate,
/**
* If set, do not display the annotation on the screen or allow it to interact
* with the user. The annotation may be printed (depending on the setting of
* the Print flag) but should be considered hidden for purposes of on-screen
* display and user interaction.
*/
NoView,
/**
* If set, do not allow the annotation to interact with the user. The
* annotation may be displayed or printed (depending on the settings of the
* NoView and Print flags) but should not respond to mouse clicks or change
* its appearance in response to mouse motions.
*
* This flag shall be ignored for widget annotations; its function is
* subsumed by the ReadOnly flag of the associated form field.
*/
ReadOnly,
/**
* If set, do not allow the annotation to be deleted or its properties
* (including position and size) to be modified by the user. However, this
* flag does not restrict changes to the annotations contents, such as the
* value of a form field.
*/
Locked,
/**
* If set, invert the interpretation of the NoView flag for certain events.
*
* A typical use is to have an annotation that appears only when a mouse
* cursor is held over it.
*/
ToggleNoView,
/**
* If set, do not allow the contents of the annotation to be modified by the
* user. This flag does not restrict deletion of the annotation or changes to
* other annotation properties, such as position and size.
*/
LockedContents
}
//# sourceMappingURL=flags.d.ts.map

View File

@@ -0,0 +1,5 @@
export { default as PDFAnnotation } from "./PDFAnnotation";
export { default as PDFWidgetAnnotation } from "./PDFWidgetAnnotation";
export { default as AppearanceCharacteristics } from "./AppearanceCharacteristics";
export * from "./flags";
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,28 @@
import PDFRef from "../objects/PDFRef";
export interface Entry {
ref: PDFRef;
offset: number;
deleted: boolean;
}
/**
* Entries should be added using the [[addEntry]] and [[addDeletedEntry]]
* methods **in order of ascending object number**.
*/
declare class PDFCrossRefSection {
static create: () => PDFCrossRefSection;
static createEmpty: () => PDFCrossRefSection;
private subsections;
private chunkIdx;
private chunkLength;
private constructor();
addEntry(ref: PDFRef, offset: number): void;
addDeletedEntry(ref: PDFRef, nextFreeObjectNumber: number): void;
toString(): string;
sizeInBytes(): number;
copyBytesInto(buffer: Uint8Array, offset: number): number;
private copySubsectionsIntoBuffer;
private copyEntriesIntoBuffer;
private append;
}
export default PDFCrossRefSection;
//# sourceMappingURL=PDFCrossRefSection.d.ts.map

View File

@@ -0,0 +1,11 @@
declare class PDFHeader {
static forVersion: (major: number, minor: number) => PDFHeader;
private readonly major;
private readonly minor;
private constructor();
toString(): string;
sizeInBytes(): number;
copyBytesInto(buffer: Uint8Array, offset: number): number;
}
export default PDFHeader;
//# sourceMappingURL=PDFHeader.d.ts.map

View File

@@ -0,0 +1,10 @@
declare class PDFTrailer {
static forLastCrossRefSectionOffset: (offset: number) => PDFTrailer;
private readonly lastXRefOffset;
private constructor();
toString(): string;
sizeInBytes(): number;
copyBytesInto(buffer: Uint8Array, offset: number): number;
}
export default PDFTrailer;
//# sourceMappingURL=PDFTrailer.d.ts.map

View File

@@ -0,0 +1,11 @@
import PDFDict from "../objects/PDFDict";
declare class PDFTrailerDict {
static of: (dict: PDFDict) => PDFTrailerDict;
readonly dict: PDFDict;
private constructor();
toString(): string;
sizeInBytes(): number;
copyBytesInto(buffer: Uint8Array, offset: number): number;
}
export default PDFTrailerDict;
//# sourceMappingURL=PDFTrailerDict.d.ts.map

View File

@@ -0,0 +1,4 @@
import { Glyph } from "../../types/fontkit";
/** `glyphs` should be an array of unique glyphs */
export declare const createCmap: (glyphs: Glyph[], glyphId: (g?: Glyph | undefined) => number) => string;
//# sourceMappingURL=CMap.d.ts.map

View File

@@ -0,0 +1,45 @@
import { Font, Fontkit, Glyph, TypeFeatures } from "../../types/fontkit";
import PDFHexString from "../objects/PDFHexString";
import PDFRef from "../objects/PDFRef";
import PDFContext from "../PDFContext";
import { Cache } from "../../utils";
/**
* A note of thanks to the developers of https://github.com/foliojs/pdfkit, as
* this class borrows from:
* https://github.com/devongovett/pdfkit/blob/e71edab0dd4657b5a767804ba86c94c58d01fbca/lib/image/jpeg.coffee
*/
declare class CustomFontEmbedder {
static for(fontkit: Fontkit, fontData: Uint8Array, customName?: string, fontFeatures?: TypeFeatures): Promise<CustomFontEmbedder>;
readonly font: Font;
readonly scale: number;
readonly fontData: Uint8Array;
readonly fontName: string;
readonly customName: string | undefined;
readonly fontFeatures: TypeFeatures | undefined;
protected baseFontName: string;
protected glyphCache: Cache<Glyph[]>;
protected constructor(font: Font, fontData: Uint8Array, customName?: string, fontFeatures?: TypeFeatures);
/**
* Encode the JavaScript string into this font. (JavaScript encodes strings in
* Unicode, but embedded fonts use their own custom encodings)
*/
encodeText(text: string): PDFHexString;
widthOfTextAtSize(text: string, size: number): number;
heightOfFontAtSize(size: number, options?: {
descender?: boolean;
}): number;
sizeOfFontAtHeight(height: number): number;
embedIntoContext(context: PDFContext, ref?: PDFRef): Promise<PDFRef>;
protected embedFontDict(context: PDFContext, ref?: PDFRef): Promise<PDFRef>;
protected isCFF(): boolean;
protected embedCIDFontDict(context: PDFContext): Promise<PDFRef>;
protected embedFontDescriptor(context: PDFContext): Promise<PDFRef>;
protected serializeFont(): Promise<Uint8Array>;
protected embedFontStream(context: PDFContext): Promise<PDFRef>;
protected embedUnicodeCmap(context: PDFContext): PDFRef;
protected glyphId(glyph?: Glyph): number;
protected computeWidths(): (number | number[])[];
private allGlyphsInFontSortedById;
}
export default CustomFontEmbedder;
//# sourceMappingURL=CustomFontEmbedder.d.ts.map

View File

@@ -0,0 +1,21 @@
import { Fontkit, Glyph, TypeFeatures } from "../../types/fontkit";
import CustomFontEmbedder from "./CustomFontEmbedder";
import PDFHexString from "../objects/PDFHexString";
/**
* A note of thanks to the developers of https://github.com/foliojs/pdfkit, as
* this class borrows from:
* https://github.com/devongovett/pdfkit/blob/e71edab0dd4657b5a767804ba86c94c58d01fbca/lib/image/jpeg.coffee
*/
declare class CustomFontSubsetEmbedder extends CustomFontEmbedder {
static for(fontkit: Fontkit, fontData: Uint8Array, customFontName?: string, fontFeatures?: TypeFeatures): Promise<CustomFontSubsetEmbedder>;
private readonly subset;
private readonly glyphs;
private readonly glyphIdMap;
private constructor();
encodeText(text: string): PDFHexString;
protected isCFF(): boolean;
protected glyphId(glyph?: Glyph): number;
protected serializeFont(): Promise<Uint8Array>;
}
export default CustomFontSubsetEmbedder;
//# sourceMappingURL=CustomFontSubsetEmbedder.d.ts.map

View File

@@ -0,0 +1,34 @@
import PDFContext from "../PDFContext";
import PDFRef from "../objects/PDFRef";
/**
* From the PDF-A3 specification, section **3.1. Requirements - General**.
* See:
* * https://www.pdfa.org/wp-content/uploads/2018/10/PDF20_AN002-AF.pdf
*/
export declare enum AFRelationship {
Source = "Source",
Data = "Data",
Alternative = "Alternative",
Supplement = "Supplement",
EncryptedPayload = "EncryptedPayload",
FormData = "EncryptedPayload",
Schema = "Schema",
Unspecified = "Unspecified"
}
export interface EmbeddedFileOptions {
mimeType?: string;
description?: string;
creationDate?: Date;
modificationDate?: Date;
afRelationship?: AFRelationship;
}
declare class FileEmbedder {
static for(bytes: Uint8Array, fileName: string, options?: EmbeddedFileOptions): FileEmbedder;
private readonly fileData;
readonly fileName: string;
readonly options: EmbeddedFileOptions;
private constructor();
embedIntoContext(context: PDFContext, ref?: PDFRef): Promise<PDFRef>;
}
export default FileEmbedder;
//# sourceMappingURL=FileEmbedder.d.ts.map

View File

@@ -0,0 +1,14 @@
import { Font } from "../../types/fontkit";
export interface FontFlagOptions {
fixedPitch?: boolean;
serif?: boolean;
symbolic?: boolean;
script?: boolean;
nonsymbolic?: boolean;
italic?: boolean;
allCap?: boolean;
smallCap?: boolean;
forceBold?: boolean;
}
export declare const deriveFontFlags: (font: Font) => number;
//# sourceMappingURL=FontFlags.d.ts.map

View File

@@ -0,0 +1,11 @@
import PDFContext from "../PDFContext";
import PDFRef from "../objects/PDFRef";
declare class JavaScriptEmbedder {
static for(script: string, scriptName: string): JavaScriptEmbedder;
private readonly script;
readonly scriptName: string;
private constructor();
embedIntoContext(context: PDFContext, ref?: PDFRef): Promise<PDFRef>;
}
export default JavaScriptEmbedder;
//# sourceMappingURL=JavaScriptEmbedder.d.ts.map

View File

@@ -0,0 +1,24 @@
import PDFRef from "../objects/PDFRef";
import PDFContext from "../PDFContext";
declare enum ColorSpace {
DeviceGray = "DeviceGray",
DeviceRGB = "DeviceRGB",
DeviceCMYK = "DeviceCMYK"
}
/**
* A note of thanks to the developers of https://github.com/foliojs/pdfkit, as
* this class borrows from:
* https://github.com/foliojs/pdfkit/blob/a6af76467ce06bd6a2af4aa7271ccac9ff152a7d/lib/image/jpeg.js
*/
declare class JpegEmbedder {
static for(imageData: Uint8Array): Promise<JpegEmbedder>;
readonly bitsPerComponent: number;
readonly height: number;
readonly width: number;
readonly colorSpace: ColorSpace;
private readonly imageData;
private constructor();
embedIntoContext(context: PDFContext, ref?: PDFRef): Promise<PDFRef>;
}
export default JpegEmbedder;
//# sourceMappingURL=JpegEmbedder.d.ts.map

View File

@@ -0,0 +1,38 @@
import PDFRef from "../objects/PDFRef";
import PDFContext from "../PDFContext";
import PDFPageLeaf from "../structures/PDFPageLeaf";
import { TransformationMatrix } from "../../types/matrix";
/**
* Represents a page bounding box.
* Usually `left` and `bottom` are 0 and right, top are equal
* to width, height if you want to clip to the whole page.
*
* y
* ^
* | +--------+ (width,height)
* | | |
* | | Page |
* | | |
* | | |
* (0,0) | +--------+
* +----------> x
*/
export interface PageBoundingBox {
left: number /** The left of the bounding box */;
bottom: number /** The bottom of the bounding box */;
right: number /** The right of the bounding box */;
top: number /** The top of the bounding box */;
}
declare class PDFPageEmbedder {
static for(page: PDFPageLeaf, boundingBox?: PageBoundingBox, transformationMatrix?: TransformationMatrix): Promise<PDFPageEmbedder>;
readonly width: number;
readonly height: number;
readonly boundingBox: PageBoundingBox;
readonly transformationMatrix: TransformationMatrix;
private readonly page;
private constructor();
embedIntoContext(context: PDFContext, ref?: PDFRef): Promise<PDFRef>;
private decodeContents;
}
export default PDFPageEmbedder;
//# sourceMappingURL=PDFPageEmbedder.d.ts.map

View File

@@ -0,0 +1,20 @@
import PDFRef from "../objects/PDFRef";
import PDFContext from "../PDFContext";
/**
* A note of thanks to the developers of https://github.com/foliojs/pdfkit, as
* this class borrows from:
* https://github.com/devongovett/pdfkit/blob/e71edab0dd4657b5a767804ba86c94c58d01fbca/lib/image/png.coffee
*/
declare class PngEmbedder {
static for(imageData: Uint8Array): Promise<PngEmbedder>;
readonly bitsPerComponent: number;
readonly height: number;
readonly width: number;
readonly colorSpace: 'DeviceRGB';
private readonly image;
private constructor();
embedIntoContext(context: PDFContext, ref?: PDFRef): Promise<PDFRef>;
private embedAlphaChannel;
}
export default PngEmbedder;
//# sourceMappingURL=PngEmbedder.d.ts.map

View File

@@ -0,0 +1,37 @@
import { Font, FontNames, EncodingType } from '@pdf-lib/standard-fonts';
import PDFHexString from "../objects/PDFHexString";
import PDFRef from "../objects/PDFRef";
import PDFContext from "../PDFContext";
export interface Glyph {
code: number;
name: string;
}
/**
* A note of thanks to the developers of https://github.com/foliojs/pdfkit, as
* this class borrows from:
* https://github.com/foliojs/pdfkit/blob/f91bdd61c164a72ea06be1a43dc0a412afc3925f/lib/font/afm.coffee
*/
declare class StandardFontEmbedder {
static for: (fontName: FontNames, customName?: string | undefined) => StandardFontEmbedder;
readonly font: Font;
readonly encoding: EncodingType;
readonly fontName: string;
readonly customName: string | undefined;
private constructor();
/**
* Encode the JavaScript string into this font. (JavaScript encodes strings in
* Unicode, but standard fonts use either WinAnsi, ZapfDingbats, or Symbol
* encodings)
*/
encodeText(text: string): PDFHexString;
widthOfTextAtSize(text: string, size: number): number;
heightOfFontAtSize(size: number, options?: {
descender?: boolean;
}): number;
sizeOfFontAtHeight(height: number): number;
embedIntoContext(context: PDFContext, ref?: PDFRef): PDFRef;
private widthOfGlyph;
private encodeTextAsGlyphs;
}
export default StandardFontEmbedder;
//# sourceMappingURL=StandardFontEmbedder.d.ts.map

92
node_modules/pdf-lib/ts3.4/es/core/errors.d.ts generated vendored Normal file
View File

@@ -0,0 +1,92 @@
import PDFObject from "./objects/PDFObject";
export declare class MethodNotImplementedError extends Error {
constructor(className: string, methodName: string);
}
export declare class PrivateConstructorError extends Error {
constructor(className: string);
}
export declare class UnexpectedObjectTypeError extends Error {
constructor(expected: any | any[], actual: any);
}
export declare class UnsupportedEncodingError extends Error {
constructor(encoding: string);
}
export declare class ReparseError extends Error {
constructor(className: string, methodName: string);
}
export declare class MissingCatalogError extends Error {
constructor(ref?: PDFObject);
}
export declare class MissingPageContentsEmbeddingError extends Error {
constructor();
}
export declare class UnrecognizedStreamTypeError extends Error {
constructor(stream: any);
}
export declare class PageEmbeddingMismatchedContextError extends Error {
constructor();
}
export declare class PDFArrayIsNotRectangleError extends Error {
constructor(size: number);
}
export declare class InvalidPDFDateStringError extends Error {
constructor(value: string);
}
export declare class InvalidTargetIndexError extends Error {
constructor(targetIndex: number, Count: number);
}
export declare class CorruptPageTreeError extends Error {
constructor(targetIndex: number, operation: string);
}
export declare class IndexOutOfBoundsError extends Error {
constructor(index: number, min: number, max: number);
}
export declare class InvalidAcroFieldValueError extends Error {
constructor();
}
export declare class MultiSelectValueError extends Error {
constructor();
}
export declare class MissingDAEntryError extends Error {
constructor(fieldName: string);
}
export declare class MissingTfOperatorError extends Error {
constructor(fieldName: string);
}
/***** Parser Errors ******/
export interface Position {
line: number;
column: number;
offset: number;
}
export declare class NumberParsingError extends Error {
constructor(pos: Position, value: string);
}
export declare class PDFParsingError extends Error {
constructor(pos: Position, details: string);
}
export declare class NextByteAssertionError extends PDFParsingError {
constructor(pos: Position, expectedByte: number, actualByte: number);
}
export declare class PDFObjectParsingError extends PDFParsingError {
constructor(pos: Position, byte: number);
}
export declare class PDFInvalidObjectParsingError extends PDFParsingError {
constructor(pos: Position);
}
export declare class PDFStreamParsingError extends PDFParsingError {
constructor(pos: Position);
}
export declare class UnbalancedParenthesisError extends PDFParsingError {
constructor(pos: Position);
}
export declare class StalledParserError extends PDFParsingError {
constructor(pos: Position);
}
export declare class MissingPDFHeaderError extends PDFParsingError {
constructor(pos: Position);
}
export declare class MissingKeywordError extends PDFParsingError {
constructor(pos: Position, keyword: number[]);
}
//# sourceMappingURL=errors.d.ts.map

48
node_modules/pdf-lib/ts3.4/es/core/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,48 @@
export * from "./errors";
export { default as CharCodes } from "./syntax/CharCodes";
export { default as PDFContext } from "./PDFContext";
export { default as PDFObjectCopier } from "./PDFObjectCopier";
export { default as PDFWriter } from "./writers/PDFWriter";
export { default as PDFStreamWriter } from "./writers/PDFStreamWriter";
export { default as PDFHeader } from "./document/PDFHeader";
export { default as PDFTrailer } from "./document/PDFTrailer";
export { default as PDFTrailerDict } from "./document/PDFTrailerDict";
export { default as PDFCrossRefSection } from "./document/PDFCrossRefSection";
export { default as StandardFontEmbedder } from "./embedders/StandardFontEmbedder";
export { default as CustomFontEmbedder } from "./embedders/CustomFontEmbedder";
export { default as CustomFontSubsetEmbedder } from "./embedders/CustomFontSubsetEmbedder";
export { default as FileEmbedder, AFRelationship, } from "./embedders/FileEmbedder";
export { default as JpegEmbedder } from "./embedders/JpegEmbedder";
export { default as PngEmbedder } from "./embedders/PngEmbedder";
export { default as PDFPageEmbedder, PageBoundingBox, } from "./embedders/PDFPageEmbedder";
export { default as ViewerPreferences, NonFullScreenPageMode, ReadingDirection, PrintScaling, Duplex, } from "./interactive/ViewerPreferences";
export { default as PDFObject } from "./objects/PDFObject";
export { default as PDFBool } from "./objects/PDFBool";
export { default as PDFNumber } from "./objects/PDFNumber";
export { default as PDFString } from "./objects/PDFString";
export { default as PDFHexString } from "./objects/PDFHexString";
export { default as PDFName } from "./objects/PDFName";
export { default as PDFNull } from "./objects/PDFNull";
export { default as PDFArray } from "./objects/PDFArray";
export { default as PDFDict } from "./objects/PDFDict";
export { default as PDFRef } from "./objects/PDFRef";
export { default as PDFInvalidObject } from "./objects/PDFInvalidObject";
export { default as PDFStream } from "./objects/PDFStream";
export { default as PDFRawStream } from "./objects/PDFRawStream";
export { default as PDFCatalog } from "./structures/PDFCatalog";
export { default as PDFContentStream } from "./structures/PDFContentStream";
export { default as PDFCrossRefStream } from "./structures/PDFCrossRefStream";
export { default as PDFObjectStream } from "./structures/PDFObjectStream";
export { default as PDFPageTree } from "./structures/PDFPageTree";
export { default as PDFPageLeaf } from "./structures/PDFPageLeaf";
export { default as PDFFlateStream } from "./structures/PDFFlateStream";
export { default as PDFOperator } from "./operators/PDFOperator";
export { default as PDFOperatorNames } from "./operators/PDFOperatorNames";
export { default as PDFObjectParser } from "./parser/PDFObjectParser";
export { default as PDFObjectStreamParser } from "./parser/PDFObjectStreamParser";
export { default as PDFParser } from "./parser/PDFParser";
export { default as PDFXRefStreamParser } from "./parser/PDFXRefStreamParser";
export { decodePDFRawStream } from "./streams/decode";
export * from "./annotation";
export * from "./acroform";
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,348 @@
import PDFArray from "../objects/PDFArray";
import PDFBool from "../objects/PDFBool";
import PDFDict from "../objects/PDFDict";
import PDFName from "../objects/PDFName";
import PDFNumber from "../objects/PDFNumber";
import PDFContext from "../PDFContext";
export declare enum NonFullScreenPageMode {
/**
* After exiting FullScreen mode, neither the document outline nor thumbnail
* images should be visible.
*/
UseNone = "UseNone",
/** After exiting FullScreen mode, the document outline should be visible. */
UseOutlines = "UseOutlines",
/** After exiting FullScreen mode, thumbnail images should be visible. */
UseThumbs = "UseThumbs",
/**
* After exiting FullScreen mode, the optional content group panel should be
* visible.
*/
UseOC = "UseOC"
}
export declare enum ReadingDirection {
/** The predominant reading order is Left to Right. */
L2R = "L2R",
/**
* The predominant reading order is Right to left (including vertical writing
* systems, such as Chinese, Japanese and Korean).
*/
R2L = "R2L"
}
export declare enum PrintScaling {
/** No page scaling. */
None = "None",
AppDefault = "AppDefault"
}
export declare enum Duplex {
/** The PDF reader should print single-sided. */
Simplex = "Simplex",
/**
* The PDF reader should print double sided and flip on the short edge of the
* sheet.
*/
DuplexFlipShortEdge = "DuplexFlipShortEdge",
/**
* The PDF reader should print double sided and flip on the long edge of the
* sheet.
*/
DuplexFlipLongEdge = "DuplexFlipLongEdge"
}
declare type BoolViewerPrefKey = 'HideToolbar' | 'HideMenubar' | 'HideWindowUI' | 'FitWindow' | 'CenterWindow' | 'DisplayDocTitle' | 'PickTrayByPDFSize';
declare type NameViewerPrefKey = 'NonFullScreenPageMode' | 'Direction' | 'PrintScaling' | 'Duplex';
interface PageRange {
start: number;
end: number;
}
declare class ViewerPreferences {
/** @ignore */
readonly dict: PDFDict;
/** @ignore */
static fromDict: (dict: PDFDict) => ViewerPreferences;
/** @ignore */
static create: (context: PDFContext) => ViewerPreferences;
/** @ignore */
protected constructor(dict: PDFDict);
protected lookupBool(key: BoolViewerPrefKey): PDFBool | undefined;
protected lookupName(key: NameViewerPrefKey): PDFName | undefined;
/** @ignore */
HideToolbar(): PDFBool | undefined;
/** @ignore */
HideMenubar(): PDFBool | undefined;
/** @ignore */
HideWindowUI(): PDFBool | undefined;
/** @ignore */
FitWindow(): PDFBool | undefined;
/** @ignore */
CenterWindow(): PDFBool | undefined;
/** @ignore */
DisplayDocTitle(): PDFBool | undefined;
/** @ignore */
NonFullScreenPageMode(): PDFName | undefined;
/** @ignore */
Direction(): PDFName | undefined;
/** @ignore */
PrintScaling(): PDFName | undefined;
/** @ignore */
Duplex(): PDFName | undefined;
/** @ignore */
PickTrayByPDFSize(): PDFBool | undefined;
/** @ignore */
PrintPageRange(): PDFArray | undefined;
/** @ignore */
NumCopies(): PDFNumber | undefined;
/**
* Returns `true` if PDF readers should hide the toolbar menus when displaying
* this document.
* @returns Whether or not toolbars should be hidden.
*/
getHideToolbar(): boolean;
/**
* Returns `true` if PDF readers should hide the menu bar when displaying this
* document.
* @returns Whether or not the menu bar should be hidden.
*/
getHideMenubar(): boolean;
/**
* Returns `true` if PDF readers should hide the user interface elements in
* the document's window (such as scroll bars and navigation controls),
* leaving only the document's contents displayed.
* @returns Whether or not user interface elements should be hidden.
*/
getHideWindowUI(): boolean;
/**
* Returns `true` if PDF readers should resize the document's window to fit
* the size of the first displayed page.
* @returns Whether or not the window should be resized to fit.
*/
getFitWindow(): boolean;
/**
* Returns `true` if PDF readers should position the document's window in the
* center of the screen.
* @returns Whether or not to center the document window.
*/
getCenterWindow(): boolean;
/**
* Returns `true` if the window's title bar should display the document
* `Title`, taken from the document metadata (see [[PDFDocument.getTitle]]).
* Returns `false` if the title bar should instead display the filename of the
* PDF file.
* @returns Whether to display the document title.
*/
getDisplayDocTitle(): boolean;
/**
* Returns the page mode, which tells the PDF reader how to display the
* document after exiting full-screen mode.
* @returns The page mode after exiting full-screen mode.
*/
getNonFullScreenPageMode(): NonFullScreenPageMode;
/**
* Returns the predominant reading order for text.
* @returns The text reading order.
*/
getReadingDirection(): ReadingDirection;
/**
* Returns the page scaling option that the PDF reader should select when the
* print dialog is displayed.
* @returns The page scaling option.
*/
getPrintScaling(): PrintScaling;
/**
* Returns the paper handling option that should be used when printing the
* file from the print dialog.
* @returns The paper handling option.
*/
getDuplex(): Duplex | undefined;
/**
* Returns `true` if the PDF page size should be used to select the input
* paper tray.
* @returns Whether or not the PDF page size should be used to select the
* input paper tray.
*/
getPickTrayByPDFSize(): boolean | undefined;
/**
* Returns an array of page number ranges, which are the values used to
* initialize the print dialog box when the file is printed. Each range
* specifies the first (`start`) and last (`end`) pages in a sub-range of
* pages to be printed. The first page of the PDF file is denoted by 0.
* For example:
* ```js
* const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences()
* const includesPage3 = viewerPrefs
* .getPrintRanges()
* .some(pr => pr.start =< 2 && pr.end >= 2)
* if (includesPage3) console.log('printRange includes page 3')
* ```
* @returns An array of objects, each with the properties `start` and `end`,
* denoting page indices. If not, specified an empty array is
* returned.
*/
getPrintPageRange(): PageRange[];
/**
* Returns the number of copies to be printed when the print dialog is opened
* for this document.
* @returns The default number of copies to be printed.
*/
getNumCopies(): number;
/**
* Choose whether the PDF reader's toolbars should be hidden while the
* document is active.
* @param hideToolbar `true` if the toolbar should be hidden.
*/
setHideToolbar(hideToolbar: boolean): void;
/**
* Choose whether the PDF reader's menu bar should be hidden while the
* document is active.
* @param hideMenubar `true` if the menu bar should be hidden.
*/
setHideMenubar(hideMenubar: boolean): void;
/**
* Choose whether the PDF reader should hide user interface elements in the
* document's window (such as scroll bars and navigation controls), leaving
* only the document's contents displayed.
* @param hideWindowUI `true` if the user interface elements should be hidden.
*/
setHideWindowUI(hideWindowUI: boolean): void;
/**
* Choose whether the PDF reader should resize the document's window to fit
* the size of the first displayed page.
* @param fitWindow `true` if the window should be resized.
*/
setFitWindow(fitWindow: boolean): void;
/**
* Choose whether the PDF reader should position the document's window in the
* center of the screen.
* @param centerWindow `true` if the window should be centered.
*/
setCenterWindow(centerWindow: boolean): void;
/**
* Choose whether the window's title bar should display the document `Title`
* taken from the document metadata (see [[PDFDocument.setTitle]]). If
* `false`, the title bar should instead display the PDF filename.
* @param displayTitle `true` if the document title should be displayed.
*/
setDisplayDocTitle(displayTitle: boolean): void;
/**
* Choose how the PDF reader should display the document upon exiting
* full-screen mode. This entry is meaningful only if the value of the
* `PageMode` entry in the document's [[PDFCatalog]] is `FullScreen`.
*
* For example:
* ```js
* import { PDFDocument, NonFullScreenPageMode, PDFName } from 'pdf-lib'
*
* const pdfDoc = await PDFDocument.create()
*
* // Set the PageMode
* pdfDoc.catalog.set(PDFName.of('PageMode'),PDFName.of('FullScreen'))
*
* // Set what happens when full-screen is closed
* const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences()
* viewerPrefs.setNonFullScreenPageMode(NonFullScreenPageMode.UseOutlines)
* ```
*
* @param nonFullScreenPageMode How the document should be displayed upon
* exiting full screen mode.
*/
setNonFullScreenPageMode(nonFullScreenPageMode: NonFullScreenPageMode): void;
/**
* Choose the predominant reading order for text.
*
* This entry has no direct effect on the document's contents or page
* numbering, but may be used to determine the relative positioning of pages
* when displayed side by side or printed n-up.
*
* For example:
* ```js
* import { PDFDocument, ReadingDirection } from 'pdf-lib'
*
* const pdfDoc = await PDFDocument.create()
* const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences()
* viewerPrefs.setReadingDirection(ReadingDirection.R2L)
* ```
*
* @param readingDirection The reading order for text.
*/
setReadingDirection(readingDirection: ReadingDirection): void;
/**
* Choose the page scaling option that should be selected when a print dialog
* is displayed for this document.
*
* For example:
* ```js
* import { PDFDocument, PrintScaling } from 'pdf-lib'
*
* const pdfDoc = await PDFDocument.create()
* const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences()
* viewerPrefs.setPrintScaling(PrintScaling.None)
* ```
*
* @param printScaling The print scaling option.
*/
setPrintScaling(printScaling: PrintScaling): void;
/**
* Choose the paper handling option that should be selected by default in the
* print dialog.
*
* For example:
* ```js
* import { PDFDocument, Duplex } from 'pdf-lib'
*
* const pdfDoc = await PDFDocument.create()
* const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences()
* viewerPrefs.setDuplex(Duplex.DuplexFlipShortEdge)
* ```
*
* @param duplex The double or single sided printing option.
*/
setDuplex(duplex: Duplex): void;
/**
* Choose whether the PDF document's page size should be used to select the
* input paper tray when printing. This setting influences only the preset
* values used to populate the print dialog presented by a PDF reader.
*
* If PickTrayByPDFSize is true, the check box in the print dialog associated
* with input paper tray should be checked. This setting has no effect on
* operating systems that do not provide the ability to pick the input tray
* by size.
*
* @param pickTrayByPDFSize `true` if the document's page size should be used
* to select the input paper tray.
*/
setPickTrayByPDFSize(pickTrayByPDFSize: boolean): void;
/**
* Choose the page numbers used to initialize the print dialog box when the
* file is printed. The first page of the PDF file is denoted by 0.
*
* For example:
* ```js
* import { PDFDocument } from 'pdf-lib'
*
* const pdfDoc = await PDFDocument.create()
* const viewerPrefs = pdfDoc.catalog.getOrCreateViewerPreferences()
*
* // We can set the default print range to only the first page
* viewerPrefs.setPrintPageRange({ start: 0, end: 0 })
*
* // Or we can supply noncontiguous ranges (e.g. pages 1, 3, and 5-7)
* viewerPrefs.setPrintPageRange([
* { start: 0, end: 0 },
* { start: 2, end: 2 },
* { start: 4, end: 6 },
* ])
* ```
*
* @param printPageRange An object or array of objects, each with the
* properties `start` and `end`, denoting a range of
* page indices.
*/
setPrintPageRange(printPageRange: PageRange[] | PageRange): void;
/**
* Choose the default number of copies to be printed when the print dialog is
* opened for this file.
* @param numCopies The default number of copies.
*/
setNumCopies(numCopies: number): void;
}
export default ViewerPreferences;
//# sourceMappingURL=ViewerPreferences.d.ts.map

View File

@@ -0,0 +1,64 @@
import PDFBool from "./PDFBool";
import PDFDict from "./PDFDict";
import PDFHexString from "./PDFHexString";
import PDFName from "./PDFName";
import PDFNull from "./PDFNull";
import PDFNumber from "./PDFNumber";
import PDFObject from "./PDFObject";
import PDFRef from "./PDFRef";
import PDFStream from "./PDFStream";
import PDFString from "./PDFString";
import PDFContext from "../PDFContext";
import PDFRawStream from "./PDFRawStream";
declare class PDFArray extends PDFObject {
static withContext: (context: PDFContext) => PDFArray;
private readonly array;
private readonly context;
private constructor();
size(): number;
push(object: PDFObject): void;
insert(index: number, object: PDFObject): void;
indexOf(object: PDFObject): number | undefined;
remove(index: number): void;
set(idx: number, object: PDFObject): void;
get(index: number): PDFObject;
lookupMaybe(index: number, type: typeof PDFArray): PDFArray | undefined;
lookupMaybe(index: number, type: typeof PDFBool): PDFBool | undefined;
lookupMaybe(index: number, type: typeof PDFDict): PDFDict | undefined;
lookupMaybe(index: number, type: typeof PDFHexString): PDFHexString | undefined;
lookupMaybe(index: number, type: typeof PDFName): PDFName | undefined;
lookupMaybe(index: number, type: typeof PDFNull): typeof PDFNull | undefined;
lookupMaybe(index: number, type: typeof PDFNumber): PDFNumber | undefined;
lookupMaybe(index: number, type: typeof PDFStream): PDFStream | undefined;
lookupMaybe(index: number, type: typeof PDFRawStream): PDFRawStream | undefined;
lookupMaybe(index: number, type: typeof PDFRef): PDFRef | undefined;
lookupMaybe(index: number, type: typeof PDFString): PDFString | undefined;
lookupMaybe(index: number, type1: typeof PDFString, type2: typeof PDFHexString): PDFString | PDFHexString | undefined;
lookup(index: number): PDFObject | undefined;
lookup(index: number, type: typeof PDFArray): PDFArray;
lookup(index: number, type: typeof PDFBool): PDFBool;
lookup(index: number, type: typeof PDFDict): PDFDict;
lookup(index: number, type: typeof PDFHexString): PDFHexString;
lookup(index: number, type: typeof PDFName): PDFName;
lookup(index: number, type: typeof PDFNull): typeof PDFNull;
lookup(index: number, type: typeof PDFNumber): PDFNumber;
lookup(index: number, type: typeof PDFStream): PDFStream;
lookup(index: number, type: typeof PDFRawStream): PDFRawStream;
lookup(index: number, type: typeof PDFRef): PDFRef;
lookup(index: number, type: typeof PDFString): PDFString;
lookup(index: number, type1: typeof PDFString, type2: typeof PDFHexString): PDFString | PDFHexString;
asRectangle(): {
x: number;
y: number;
width: number;
height: number;
};
asArray(): PDFObject[];
clone(context?: PDFContext): PDFArray;
toString(): string;
sizeInBytes(): number;
copyBytesInto(buffer: Uint8Array, offset: number): number;
scalePDFNumbers(x: number, y: number): void;
}
export default PDFArray;
//# sourceMappingURL=PDFArray.d.ts.map

View File

@@ -0,0 +1,14 @@
import PDFObject from "./PDFObject";
declare class PDFBool extends PDFObject {
static readonly True: PDFBool;
static readonly False: PDFBool;
private readonly value;
private constructor();
asBoolean(): boolean;
clone(): PDFBool;
toString(): string;
sizeInBytes(): number;
copyBytesInto(buffer: Uint8Array, offset: number): number;
}
export default PDFBool;
//# sourceMappingURL=PDFBool.d.ts.map

View File

@@ -0,0 +1,62 @@
import PDFArray from "./PDFArray";
import PDFBool from "./PDFBool";
import PDFHexString from "./PDFHexString";
import PDFName from "./PDFName";
import PDFNull from "./PDFNull";
import PDFNumber from "./PDFNumber";
import PDFObject from "./PDFObject";
import PDFRef from "./PDFRef";
import PDFStream from "./PDFStream";
import PDFString from "./PDFString";
import PDFContext from "../PDFContext";
export declare type DictMap = Map<PDFName, PDFObject>;
declare class PDFDict extends PDFObject {
static withContext: (context: PDFContext) => PDFDict;
static fromMapWithContext: (map: DictMap, context: PDFContext) => PDFDict;
readonly context: PDFContext;
private readonly dict;
protected constructor(map: DictMap, context: PDFContext);
keys(): PDFName[];
values(): PDFObject[];
entries(): [PDFName, PDFObject][];
set(key: PDFName, value: PDFObject): void;
get(key: PDFName, preservePDFNull?: boolean): PDFObject | undefined;
has(key: PDFName): boolean;
lookupMaybe(key: PDFName, type: typeof PDFArray): PDFArray | undefined;
lookupMaybe(key: PDFName, type: typeof PDFBool): PDFBool | undefined;
lookupMaybe(key: PDFName, type: typeof PDFDict): PDFDict | undefined;
lookupMaybe(key: PDFName, type: typeof PDFHexString): PDFHexString | undefined;
lookupMaybe(key: PDFName, type: typeof PDFName): PDFName | undefined;
lookupMaybe(key: PDFName, type: typeof PDFNull): typeof PDFNull | undefined;
lookupMaybe(key: PDFName, type: typeof PDFNumber): PDFNumber | undefined;
lookupMaybe(key: PDFName, type: typeof PDFStream): PDFStream | undefined;
lookupMaybe(key: PDFName, type: typeof PDFRef): PDFRef | undefined;
lookupMaybe(key: PDFName, type: typeof PDFString): PDFString | undefined;
lookupMaybe(ref: PDFName, type1: typeof PDFString, type2: typeof PDFHexString): PDFString | PDFHexString | undefined;
lookupMaybe(ref: PDFName, type1: typeof PDFDict, type2: typeof PDFStream): PDFDict | PDFStream | undefined;
lookupMaybe(ref: PDFName, type1: typeof PDFString, type2: typeof PDFHexString, type3: typeof PDFArray): PDFString | PDFHexString | PDFArray | undefined;
lookup(key: PDFName): PDFObject | undefined;
lookup(key: PDFName, type: typeof PDFArray): PDFArray;
lookup(key: PDFName, type: typeof PDFBool): PDFBool;
lookup(key: PDFName, type: typeof PDFDict): PDFDict;
lookup(key: PDFName, type: typeof PDFHexString): PDFHexString;
lookup(key: PDFName, type: typeof PDFName): PDFName;
lookup(key: PDFName, type: typeof PDFNull): typeof PDFNull;
lookup(key: PDFName, type: typeof PDFNumber): PDFNumber;
lookup(key: PDFName, type: typeof PDFStream): PDFStream;
lookup(key: PDFName, type: typeof PDFRef): PDFRef;
lookup(key: PDFName, type: typeof PDFString): PDFString;
lookup(ref: PDFName, type1: typeof PDFString, type2: typeof PDFHexString): PDFString | PDFHexString;
lookup(ref: PDFName, type1: typeof PDFDict, type2: typeof PDFStream): PDFDict | PDFStream;
lookup(ref: PDFName, type1: typeof PDFString, type2: typeof PDFHexString, type3: typeof PDFArray): PDFString | PDFHexString | PDFArray;
delete(key: PDFName): boolean;
asMap(): Map<PDFName, PDFObject>;
/** Generate a random key that doesn't exist in current key set */
uniqueKey(tag?: string): PDFName;
clone(context?: PDFContext): PDFDict;
toString(): string;
sizeInBytes(): number;
copyBytesInto(buffer: Uint8Array, offset: number): number;
}
export default PDFDict;
//# sourceMappingURL=PDFDict.d.ts.map

View File

@@ -0,0 +1,17 @@
import PDFObject from "./PDFObject";
declare class PDFHexString extends PDFObject {
static of: (value: string) => PDFHexString;
static fromText: (value: string) => PDFHexString;
private readonly value;
constructor(value: string);
asBytes(): Uint8Array;
decodeText(): string;
decodeDate(): Date;
asString(): string;
clone(): PDFHexString;
toString(): string;
sizeInBytes(): number;
copyBytesInto(buffer: Uint8Array, offset: number): number;
}
export default PDFHexString;
//# sourceMappingURL=PDFHexString.d.ts.map

View File

@@ -0,0 +1,12 @@
import PDFObject from "./PDFObject";
declare class PDFInvalidObject extends PDFObject {
static of: (data: Uint8Array) => PDFInvalidObject;
private readonly data;
private constructor();
clone(): PDFInvalidObject;
toString(): string;
sizeInBytes(): number;
copyBytesInto(buffer: Uint8Array, offset: number): number;
}
export default PDFInvalidObject;
//# sourceMappingURL=PDFInvalidObject.d.ts.map

View File

@@ -0,0 +1,42 @@
import PDFObject from "./PDFObject";
declare class PDFName extends PDFObject {
static of: (name: string) => PDFName;
static readonly Length: PDFName;
static readonly FlateDecode: PDFName;
static readonly Resources: PDFName;
static readonly Font: PDFName;
static readonly XObject: PDFName;
static readonly ExtGState: PDFName;
static readonly Contents: PDFName;
static readonly Type: PDFName;
static readonly Parent: PDFName;
static readonly MediaBox: PDFName;
static readonly Page: PDFName;
static readonly Annots: PDFName;
static readonly TrimBox: PDFName;
static readonly ArtBox: PDFName;
static readonly BleedBox: PDFName;
static readonly CropBox: PDFName;
static readonly Rotate: PDFName;
static readonly Title: PDFName;
static readonly Author: PDFName;
static readonly Subject: PDFName;
static readonly Creator: PDFName;
static readonly Keywords: PDFName;
static readonly Producer: PDFName;
static readonly CreationDate: PDFName;
static readonly ModDate: PDFName;
private readonly encodedName;
private constructor();
asBytes(): Uint8Array;
decodeText(): string;
asString(): string;
/** @deprecated in favor of [[PDFName.asString]] */
value(): string;
clone(): PDFName;
toString(): string;
sizeInBytes(): number;
copyBytesInto(buffer: Uint8Array, offset: number): number;
}
export default PDFName;
//# sourceMappingURL=PDFName.d.ts.map

View File

@@ -0,0 +1,11 @@
import PDFObject from "./PDFObject";
declare class PDFNull extends PDFObject {
asNull(): null;
clone(): PDFNull;
toString(): string;
sizeInBytes(): number;
copyBytesInto(buffer: Uint8Array, offset: number): number;
}
declare const _default: PDFNull;
export default _default;
//# sourceMappingURL=PDFNull.d.ts.map

View File

@@ -0,0 +1,16 @@
import PDFObject from "./PDFObject";
declare class PDFNumber extends PDFObject {
static of: (value: number) => PDFNumber;
private readonly numberValue;
private readonly stringValue;
private constructor();
asNumber(): number;
/** @deprecated in favor of [[PDFNumber.asNumber]] */
value(): number;
clone(): PDFNumber;
toString(): string;
sizeInBytes(): number;
copyBytesInto(buffer: Uint8Array, offset: number): number;
}
export default PDFNumber;
//# sourceMappingURL=PDFNumber.d.ts.map

View File

@@ -0,0 +1,9 @@
import PDFContext from "../PDFContext";
declare class PDFObject {
clone(_context?: PDFContext): PDFObject;
toString(): string;
sizeInBytes(): number;
copyBytesInto(_buffer: Uint8Array, _offset: number): number;
}
export default PDFObject;
//# sourceMappingURL=PDFObject.d.ts.map

View File

@@ -0,0 +1,15 @@
import PDFDict from "./PDFDict";
import PDFStream from "./PDFStream";
import PDFContext from "../PDFContext";
declare class PDFRawStream extends PDFStream {
static of: (dict: PDFDict, contents: Uint8Array) => PDFRawStream;
readonly contents: Uint8Array;
private constructor();
asUint8Array(): Uint8Array;
clone(context?: PDFContext): PDFRawStream;
getContentsString(): string;
getContents(): Uint8Array;
getContentsSize(): number;
}
export default PDFRawStream;
//# sourceMappingURL=PDFRawStream.d.ts.map

14
node_modules/pdf-lib/ts3.4/es/core/objects/PDFRef.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import PDFObject from "./PDFObject";
declare class PDFRef extends PDFObject {
static of: (objectNumber: number, generationNumber?: number) => PDFRef;
readonly objectNumber: number;
readonly generationNumber: number;
readonly tag: string;
private constructor();
clone(): PDFRef;
toString(): string;
sizeInBytes(): number;
copyBytesInto(buffer: Uint8Array, offset: number): number;
}
export default PDFRef;
//# sourceMappingURL=PDFRef.d.ts.map

View File

@@ -0,0 +1,17 @@
import PDFDict from "./PDFDict";
import PDFObject from "./PDFObject";
import PDFContext from "../PDFContext";
declare class PDFStream extends PDFObject {
readonly dict: PDFDict;
constructor(dict: PDFDict);
clone(_context?: PDFContext): PDFStream;
getContentsString(): string;
getContents(): Uint8Array;
getContentsSize(): number;
updateDict(): void;
sizeInBytes(): number;
toString(): string;
copyBytesInto(buffer: Uint8Array, offset: number): number;
}
export default PDFStream;
//# sourceMappingURL=PDFStream.d.ts.map

View File

@@ -0,0 +1,17 @@
import PDFObject from "./PDFObject";
declare class PDFString extends PDFObject {
static of: (value: string) => PDFString;
static fromDate: (date: Date) => PDFString;
private readonly value;
private constructor();
asBytes(): Uint8Array;
decodeText(): string;
decodeDate(): Date;
asString(): string;
clone(): PDFString;
toString(): string;
sizeInBytes(): number;
copyBytesInto(buffer: Uint8Array, offset: number): number;
}
export default PDFString;
//# sourceMappingURL=PDFString.d.ts.map

View File

@@ -0,0 +1,20 @@
import PDFArray from "../objects/PDFArray";
import PDFHexString from "../objects/PDFHexString";
import PDFName from "../objects/PDFName";
import PDFNumber from "../objects/PDFNumber";
import PDFString from "../objects/PDFString";
import PDFOperatorNames from "./PDFOperatorNames";
import PDFContext from "../PDFContext";
export declare type PDFOperatorArg = string | PDFName | PDFArray | PDFNumber | PDFString | PDFHexString;
declare class PDFOperator {
static of: (name: PDFOperatorNames, args?: PDFOperatorArg[] | undefined) => PDFOperator;
private readonly name;
private readonly args;
private constructor();
clone(context?: PDFContext): PDFOperator;
toString(): string;
sizeInBytes(): number;
copyBytesInto(buffer: Uint8Array, offset: number): number;
}
export default PDFOperator;
//# sourceMappingURL=PDFOperator.d.ts.map

View File

@@ -0,0 +1,77 @@
declare enum PDFOperatorNames {
NonStrokingColor = "sc",
NonStrokingColorN = "scn",
NonStrokingColorRgb = "rg",
NonStrokingColorGray = "g",
NonStrokingColorCmyk = "k",
NonStrokingColorspace = "cs",
StrokingColor = "SC",
StrokingColorN = "SCN",
StrokingColorRgb = "RG",
StrokingColorGray = "G",
StrokingColorCmyk = "K",
StrokingColorspace = "CS",
BeginMarkedContentSequence = "BDC",
BeginMarkedContent = "BMC",
EndMarkedContent = "EMC",
MarkedContentPointWithProps = "DP",
MarkedContentPoint = "MP",
DrawObject = "Do",
ConcatTransformationMatrix = "cm",
PopGraphicsState = "Q",
PushGraphicsState = "q",
SetFlatness = "i",
SetGraphicsStateParams = "gs",
SetLineCapStyle = "J",
SetLineDashPattern = "d",
SetLineJoinStyle = "j",
SetLineMiterLimit = "M",
SetLineWidth = "w",
SetTextMatrix = "Tm",
SetRenderingIntent = "ri",
AppendRectangle = "re",
BeginInlineImage = "BI",
BeginInlineImageData = "ID",
EndInlineImage = "EI",
ClipEvenOdd = "W*",
ClipNonZero = "W",
CloseAndStroke = "s",
CloseFillEvenOddAndStroke = "b*",
CloseFillNonZeroAndStroke = "b",
ClosePath = "h",
AppendBezierCurve = "c",
CurveToReplicateFinalPoint = "y",
CurveToReplicateInitialPoint = "v",
EndPath = "n",
FillEvenOddAndStroke = "B*",
FillEvenOdd = "f*",
FillNonZeroAndStroke = "B",
FillNonZero = "f",
LegacyFillNonZero = "F",
LineTo = "l",
MoveTo = "m",
ShadingFill = "sh",
StrokePath = "S",
BeginText = "BT",
EndText = "ET",
MoveText = "Td",
MoveTextSetLeading = "TD",
NextLine = "T*",
SetCharacterSpacing = "Tc",
SetFontAndSize = "Tf",
SetTextHorizontalScaling = "Tz",
SetTextLineHeight = "TL",
SetTextRenderingMode = "Tr",
SetTextRise = "Ts",
SetWordSpacing = "Tw",
ShowText = "Tj",
ShowTextAdjusted = "TJ",
ShowTextLine = "'",
ShowTextLineAndSpace = "\"",
Type3D0 = "d0",
Type3D1 = "d1",
BeginCompatibilitySection = "BX",
EndCompatibilitySection = "EX"
}
export default PDFOperatorNames;
//# sourceMappingURL=PDFOperatorNames.d.ts.map

View File

@@ -0,0 +1,15 @@
import ByteStream from "./ByteStream";
declare class BaseParser {
protected readonly bytes: ByteStream;
protected readonly capNumbers: boolean;
constructor(bytes: ByteStream, capNumbers?: boolean);
protected parseRawInt(): number;
protected parseRawNumber(): number;
protected skipWhitespace(): void;
protected skipLine(): void;
protected skipComment(): boolean;
protected skipWhitespaceAndComments(): void;
protected matchKeyword(keyword: number[]): boolean;
}
export default BaseParser;
//# sourceMappingURL=BaseParser.d.ts.map

View File

@@ -0,0 +1,27 @@
import PDFRawStream from "../objects/PDFRawStream";
declare class ByteStream {
static of: (bytes: Uint8Array) => ByteStream;
static fromPDFRawStream: (rawStream: PDFRawStream) => ByteStream;
private readonly bytes;
private readonly length;
private idx;
private line;
private column;
constructor(bytes: Uint8Array);
moveTo(offset: number): void;
next(): number;
assertNext(expected: number): number;
peek(): number;
peekAhead(steps: number): number;
peekAt(offset: number): number;
done(): boolean;
offset(): number;
slice(start: number, end: number): Uint8Array;
position(): {
line: number;
column: number;
offset: number;
};
}
export default ByteStream;
//# sourceMappingURL=ByteStream.d.ts.map

View File

@@ -0,0 +1,30 @@
import { Position } from "../errors";
import PDFArray from "../objects/PDFArray";
import PDFDict from "../objects/PDFDict";
import PDFHexString from "../objects/PDFHexString";
import PDFName from "../objects/PDFName";
import PDFNumber from "../objects/PDFNumber";
import PDFObject from "../objects/PDFObject";
import PDFRef from "../objects/PDFRef";
import PDFStream from "../objects/PDFStream";
import PDFString from "../objects/PDFString";
import BaseParser from "./BaseParser";
import ByteStream from "./ByteStream";
import PDFContext from "../PDFContext";
declare class PDFObjectParser extends BaseParser {
static forBytes: (bytes: Uint8Array, context: PDFContext, capNumbers?: boolean | undefined) => PDFObjectParser;
static forByteStream: (byteStream: ByteStream, context: PDFContext, capNumbers?: boolean) => PDFObjectParser;
protected readonly context: PDFContext;
constructor(byteStream: ByteStream, context: PDFContext, capNumbers?: boolean);
parseObject(): PDFObject;
protected parseNumberOrRef(): PDFNumber | PDFRef;
protected parseHexString(): PDFHexString;
protected parseString(): PDFString;
protected parseName(): PDFName;
protected parseArray(): PDFArray;
protected parseDict(): PDFDict;
protected parseDictOrStream(): PDFDict | PDFStream;
protected findEndOfStreamFallback(startPos: Position): number;
}
export default PDFObjectParser;
//# sourceMappingURL=PDFObjectParser.d.ts.map

View File

@@ -0,0 +1,14 @@
import PDFRawStream from "../objects/PDFRawStream";
import PDFObjectParser from "./PDFObjectParser";
declare class PDFObjectStreamParser extends PDFObjectParser {
static forStream: (rawStream: PDFRawStream, shouldWaitForTick?: (() => boolean) | undefined) => PDFObjectStreamParser;
private alreadyParsed;
private readonly shouldWaitForTick;
private readonly firstOffset;
private readonly objectCount;
constructor(rawStream: PDFRawStream, shouldWaitForTick?: () => boolean);
parseIntoContext(): Promise<void>;
private parseOffsetsAndObjectNumbers;
}
export default PDFObjectStreamParser;
//# sourceMappingURL=PDFObjectStreamParser.d.ts.map

View File

@@ -0,0 +1,46 @@
import PDFObjectParser from "./PDFObjectParser";
import PDFContext from "../PDFContext";
declare class PDFParser extends PDFObjectParser {
static forBytesWithOptions: (pdfBytes: Uint8Array, objectsPerTick?: number | undefined, throwOnInvalidObject?: boolean | undefined, capNumbers?: boolean | undefined) => PDFParser;
private readonly objectsPerTick;
private readonly throwOnInvalidObject;
private alreadyParsed;
private parsedObjects;
constructor(pdfBytes: Uint8Array, objectsPerTick?: number, throwOnInvalidObject?: boolean, capNumbers?: boolean);
parseDocument(): Promise<PDFContext>;
private maybeRecoverRoot;
private parseHeader;
private parseIndirectObjectHeader;
private matchIndirectObjectHeader;
private shouldWaitForTick;
private parseIndirectObject;
private tryToParseInvalidIndirectObject;
private parseIndirectObjects;
private maybeParseCrossRefSection;
private maybeParseTrailerDict;
private maybeParseTrailer;
private parseDocumentSection;
/**
* This operation is not necessary for valid PDF files. But some invalid PDFs
* contain jibberish in between indirect objects. This method is designed to
* skip past that jibberish, should it exist, until it reaches the next
* indirect object header, an xref table section, or the file trailer.
*/
private skipJibberish;
/**
* Skips the binary comment following a PDF header. The specification
* defines this binary comment (section 7.5.2 File Header) as a sequence of 4
* or more bytes that are 128 or greater, and which are preceded by a "%".
*
* This would imply that to strip out this binary comment, we could check for
* a sequence of bytes starting with "%", and remove all subsequent bytes that
* are 128 or greater. This works for many documents that properly comply with
* the spec. But in the wild, there are PDFs that omit the leading "%", and
* include bytes that are less than 128 (e.g. 0 or 1). So in order to parse
* these headers correctly, we just throw out all bytes leading up to the
* first indirect object header.
*/
private skipBinaryHeaderComment;
}
export default PDFParser;
//# sourceMappingURL=PDFParser.d.ts.map

View File

@@ -0,0 +1,22 @@
import PDFRawStream from "../objects/PDFRawStream";
import PDFRef from "../objects/PDFRef";
export interface Entry {
ref: PDFRef;
offset: number;
deleted: boolean;
inObjectStream: boolean;
}
declare class PDFXRefStreamParser {
static forStream: (rawStream: PDFRawStream) => PDFXRefStreamParser;
private alreadyParsed;
private readonly dict;
private readonly context;
private readonly bytes;
private readonly subsections;
private readonly byteWidths;
constructor(rawStream: PDFRawStream);
parseIntoContext(): Entry[];
private parseEntries;
}
export default PDFXRefStreamParser;
//# sourceMappingURL=PDFXRefStreamParser.d.ts.map

View File

@@ -0,0 +1,10 @@
import DecodeStream from "./DecodeStream";
import { StreamType } from "./Stream";
declare class Ascii85Stream extends DecodeStream {
private stream;
private input;
constructor(stream: StreamType, maybeLength?: number);
protected readBlock(): void;
}
export default Ascii85Stream;
//# sourceMappingURL=Ascii85Stream.d.ts.map

View File

@@ -0,0 +1,10 @@
import DecodeStream from "./DecodeStream";
import { StreamType } from "./Stream";
declare class AsciiHexStream extends DecodeStream {
private stream;
private firstDigit;
constructor(stream: StreamType, maybeLength?: number);
protected readBlock(): void;
}
export default AsciiHexStream;
//# sourceMappingURL=AsciiHexStream.d.ts.map

View File

@@ -0,0 +1,27 @@
import Stream, { StreamType } from "./Stream";
/**
* Super class for the decoding streams
*/
declare class DecodeStream implements StreamType {
protected bufferLength: number;
protected buffer: Uint8Array;
protected eof: boolean;
private pos;
private minBufferLength;
constructor(maybeMinBufferLength?: number);
readonly isEmpty: boolean;
getByte(): number;
getUint16(): number;
getInt32(): number;
getBytes(length: number, forceClamped?: boolean): Uint8Array | Uint8ClampedArray;
peekByte(): number;
peekBytes(length: number, forceClamped?: boolean): Uint8Array | Uint8ClampedArray;
skip(n: number): void;
reset(): void;
makeSubStream(start: number, length: number): Stream;
decode(): Uint8Array;
protected readBlock(): void;
protected ensureBuffer(requested: number): Uint8Array;
}
export default DecodeStream;
//# sourceMappingURL=DecodeStream.d.ts.map

View File

@@ -0,0 +1,14 @@
import DecodeStream from "./DecodeStream";
import { StreamType } from "./Stream";
declare class FlateStream extends DecodeStream {
private stream;
private codeSize;
private codeBuf;
constructor(stream: StreamType, maybeLength?: number);
protected readBlock(): void;
private getBits;
private getCode;
private generateHuffmanTable;
}
export default FlateStream;
//# sourceMappingURL=FlateStream.d.ts.map

View File

@@ -0,0 +1,13 @@
import DecodeStream from "./DecodeStream";
import { StreamType } from "./Stream";
declare class LZWStream extends DecodeStream {
private stream;
private cachedData;
private bitsCached;
private lzwState;
constructor(stream: StreamType, maybeLength: number | undefined, earlyChange: 0 | 1);
protected readBlock(): void;
private readBits;
}
export default LZWStream;
//# sourceMappingURL=LZWStream.d.ts.map

View File

@@ -0,0 +1,9 @@
import DecodeStream from "./DecodeStream";
import { StreamType } from "./Stream";
declare class RunLengthStream extends DecodeStream {
private stream;
constructor(stream: StreamType, maybeLength?: number);
protected readBlock(): void;
}
export default RunLengthStream;
//# sourceMappingURL=RunLengthStream.d.ts.map

35
node_modules/pdf-lib/ts3.4/es/core/streams/Stream.d.ts generated vendored Normal file
View File

@@ -0,0 +1,35 @@
export interface StreamType {
isEmpty: boolean;
getByte(): number;
getUint16(): number;
getInt32(): number;
getBytes(length: number, forceClamped?: boolean): Uint8Array | Uint8ClampedArray;
peekByte(): number;
peekBytes(length: number, forceClamped?: boolean): Uint8Array | Uint8ClampedArray;
skip(n: number): void;
reset(): void;
makeSubStream(start: number, length: number): StreamType;
decode(): Uint8Array;
}
declare class Stream implements StreamType {
private bytes;
private start;
private pos;
private end;
constructor(buffer: Uint8Array, start?: number, length?: number);
readonly length: number;
readonly isEmpty: boolean;
getByte(): number;
getUint16(): number;
getInt32(): number;
getBytes(length: number, forceClamped?: boolean): Uint8Array | Uint8ClampedArray;
peekByte(): number;
peekBytes(length: number, forceClamped?: boolean): Uint8Array | Uint8ClampedArray;
skip(n: number): void;
reset(): void;
moveStart(): void;
makeSubStream(start: number, length: number): Stream;
decode(): Uint8Array;
}
export default Stream;
//# sourceMappingURL=Stream.d.ts.map

View File

@@ -0,0 +1,4 @@
import PDFRawStream from "../objects/PDFRawStream";
import { StreamType } from "./Stream";
export declare const decodePDFRawStream: ({ dict, contents }: PDFRawStream) => StreamType;
//# sourceMappingURL=decode.d.ts.map

View File

@@ -0,0 +1,28 @@
import PDFDict, { DictMap } from "../objects/PDFDict";
import PDFRef from "../objects/PDFRef";
import PDFContext from "../PDFContext";
import PDFPageTree from "./PDFPageTree";
import { PDFAcroForm } from "../acroform";
import ViewerPreferences from '../interactive/ViewerPreferences';
declare class PDFCatalog extends PDFDict {
static withContextAndPages: (context: PDFContext, pages: PDFPageTree | PDFRef) => PDFCatalog;
static fromMapWithContext: (map: DictMap, context: PDFContext) => PDFCatalog;
Pages(): PDFPageTree;
AcroForm(): PDFDict | undefined;
getAcroForm(): PDFAcroForm | undefined;
getOrCreateAcroForm(): PDFAcroForm;
ViewerPreferences(): PDFDict | undefined;
getViewerPreferences(): ViewerPreferences | undefined;
getOrCreateViewerPreferences(): ViewerPreferences;
/**
* Inserts the given ref as a leaf node of this catalog's page tree at the
* specified index (zero-based). Also increments the `Count` of each node in
* the page tree hierarchy to accomodate the new page.
*
* Returns the ref of the PDFPageTree node into which `leafRef` was inserted.
*/
insertLeafNode(leafRef: PDFRef, index: number): PDFRef;
removeLeafNode(index: number): void;
}
export default PDFCatalog;
//# sourceMappingURL=PDFCatalog.d.ts.map

View File

@@ -0,0 +1,16 @@
import PDFDict from "../objects/PDFDict";
import PDFOperator from "../operators/PDFOperator";
import PDFContext from "../PDFContext";
import PDFFlateStream from "./PDFFlateStream";
declare class PDFContentStream extends PDFFlateStream {
static of: (dict: PDFDict, operators: PDFOperator[], encode?: boolean) => PDFContentStream;
private readonly operators;
private constructor();
push(...operators: PDFOperator[]): void;
clone(context?: PDFContext): PDFContentStream;
getContentsString(): string;
getUnencodedContents(): Uint8Array;
getUnencodedContentsSize(): number;
}
export default PDFContentStream;
//# sourceMappingURL=PDFContentStream.d.ts.map

View File

@@ -0,0 +1,54 @@
import PDFDict from "../objects/PDFDict";
import PDFRef from "../objects/PDFRef";
import PDFContext from "../PDFContext";
import PDFFlateStream from "./PDFFlateStream";
export declare enum EntryType {
Deleted = 0,
Uncompressed = 1,
Compressed = 2
}
export interface DeletedEntry {
type: EntryType.Deleted;
ref: PDFRef;
nextFreeObjectNumber: number;
}
export interface UncompressedEntry {
type: EntryType.Uncompressed;
ref: PDFRef;
offset: number;
}
export interface CompressedEntry {
type: EntryType.Compressed;
ref: PDFRef;
objectStreamRef: PDFRef;
index: number;
}
export declare type Entry = DeletedEntry | UncompressedEntry | CompressedEntry;
export declare type EntryTuple = [number, number, number];
/**
* Entries should be added using the [[addDeletedEntry]],
* [[addUncompressedEntry]], and [[addCompressedEntry]] methods
* **in order of ascending object number**.
*/
declare class PDFCrossRefStream extends PDFFlateStream {
static create: (dict: PDFDict, encode?: boolean) => PDFCrossRefStream;
static of: (dict: PDFDict, entries: Entry[], encode?: boolean) => PDFCrossRefStream;
private readonly entries;
private readonly entryTuplesCache;
private readonly maxByteWidthsCache;
private readonly indexCache;
private constructor();
addDeletedEntry(ref: PDFRef, nextFreeObjectNumber: number): void;
addUncompressedEntry(ref: PDFRef, offset: number): void;
addCompressedEntry(ref: PDFRef, objectStreamRef: PDFRef, index: number): void;
clone(context?: PDFContext): PDFCrossRefStream;
getContentsString(): string;
getUnencodedContents(): Uint8Array;
getUnencodedContentsSize(): number;
updateDict(): void;
private computeIndex;
private computeEntryTuples;
private computeMaxEntryByteWidths;
}
export default PDFCrossRefStream;
//# sourceMappingURL=PDFCrossRefStream.d.ts.map

View File

@@ -0,0 +1,14 @@
import PDFDict from "../objects/PDFDict";
import PDFStream from "../objects/PDFStream";
import { Cache } from "../../utils";
declare class PDFFlateStream extends PDFStream {
protected readonly contentsCache: Cache<Uint8Array>;
protected readonly encode: boolean;
constructor(dict: PDFDict, encode: boolean);
computeContents: () => Uint8Array;
getContents(): Uint8Array;
getContentsSize(): number;
getUnencodedContents(): Uint8Array;
}
export default PDFFlateStream;
//# sourceMappingURL=PDFFlateStream.d.ts.map

View File

@@ -0,0 +1,21 @@
import PDFObject from "../objects/PDFObject";
import PDFRef from "../objects/PDFRef";
import PDFContext from "../PDFContext";
import PDFFlateStream from "./PDFFlateStream";
export declare type IndirectObject = [PDFRef, PDFObject];
declare class PDFObjectStream extends PDFFlateStream {
static withContextAndObjects: (context: PDFContext, objects: IndirectObject[], encode?: boolean) => PDFObjectStream;
private readonly objects;
private readonly offsets;
private readonly offsetsString;
private constructor();
getObjectsCount(): number;
clone(context?: PDFContext): PDFObjectStream;
getContentsString(): string;
getUnencodedContents(): Uint8Array;
getUnencodedContentsSize(): number;
private computeOffsetsString;
private computeObjectOffsets;
}
export default PDFObjectStream;
//# sourceMappingURL=PDFObjectStream.d.ts.map

View File

@@ -0,0 +1,55 @@
import PDFArray from "../objects/PDFArray";
import PDFDict, { DictMap } from "../objects/PDFDict";
import PDFName from "../objects/PDFName";
import PDFNumber from "../objects/PDFNumber";
import PDFObject from "../objects/PDFObject";
import PDFRef from "../objects/PDFRef";
import PDFStream from "../objects/PDFStream";
import PDFContext from "../PDFContext";
import PDFPageTree from "./PDFPageTree";
declare class PDFPageLeaf extends PDFDict {
static readonly InheritableEntries: string[];
static withContextAndParent: (context: PDFContext, parent: PDFRef) => PDFPageLeaf;
static fromMapWithContext: (map: DictMap, context: PDFContext, autoNormalizeCTM?: boolean) => PDFPageLeaf;
private normalized;
private readonly autoNormalizeCTM;
private constructor();
clone(context?: PDFContext): PDFPageLeaf;
Parent(): PDFPageTree | undefined;
Contents(): PDFStream | PDFArray | undefined;
Annots(): PDFArray | undefined;
BleedBox(): PDFArray | undefined;
TrimBox(): PDFArray | undefined;
ArtBox(): PDFArray | undefined;
Resources(): PDFDict | undefined;
MediaBox(): PDFArray;
CropBox(): PDFArray | undefined;
Rotate(): PDFNumber | undefined;
getInheritableAttribute(name: PDFName): PDFObject | undefined;
setParent(parentRef: PDFRef): void;
addContentStream(contentStreamRef: PDFRef): void;
wrapContentStreams(startStream: PDFRef, endStream: PDFRef): boolean;
addAnnot(annotRef: PDFRef): void;
removeAnnot(annotRef: PDFRef): void;
setFontDictionary(name: PDFName, fontDictRef: PDFRef): void;
newFontDictionaryKey(tag: string): PDFName;
newFontDictionary(tag: string, fontDictRef: PDFRef): PDFName;
setXObject(name: PDFName, xObjectRef: PDFRef): void;
newXObjectKey(tag: string): PDFName;
newXObject(tag: string, xObjectRef: PDFRef): PDFName;
setExtGState(name: PDFName, extGStateRef: PDFRef | PDFDict): void;
newExtGStateKey(tag: string): PDFName;
newExtGState(tag: string, extGStateRef: PDFRef | PDFDict): PDFName;
ascend(visitor: (node: PDFPageTree | PDFPageLeaf) => any): void;
normalize(): void;
normalizedEntries(): {
Annots: PDFArray;
Resources: PDFDict;
Contents: PDFArray | undefined;
Font: PDFDict;
XObject: PDFDict;
ExtGState: PDFDict;
};
}
export default PDFPageLeaf;
//# sourceMappingURL=PDFPageLeaf.d.ts.map

View File

@@ -0,0 +1,42 @@
import PDFArray from "../objects/PDFArray";
import PDFDict, { DictMap } from "../objects/PDFDict";
import PDFNumber from "../objects/PDFNumber";
import PDFRef from "../objects/PDFRef";
import PDFContext from "../PDFContext";
import PDFPageLeaf from "./PDFPageLeaf";
export declare type TreeNode = PDFPageTree | PDFPageLeaf;
declare class PDFPageTree extends PDFDict {
static withContext: (context: PDFContext, parent?: PDFRef | undefined) => PDFPageTree;
static fromMapWithContext: (map: DictMap, context: PDFContext) => PDFPageTree;
Parent(): PDFPageTree | undefined;
Kids(): PDFArray;
Count(): PDFNumber;
pushTreeNode(treeRef: PDFRef): void;
pushLeafNode(leafRef: PDFRef): void;
/**
* Inserts the given ref as a leaf node of this page tree at the specified
* index (zero-based). Also increments the `Count` of each page tree in the
* hierarchy to accomodate the new page.
*
* Returns the ref of the PDFPageTree node into which `leafRef` was inserted,
* or `undefined` if it was inserted into the root node (the PDFPageTree upon
* which the method was first called).
*/
insertLeafNode(leafRef: PDFRef, targetIndex: number): PDFRef | undefined;
/**
* Removes the leaf node at the specified index (zero-based) from this page
* tree. Also decrements the `Count` of each page tree in the hierarchy to
* account for the removed page.
*
* If `prune` is true, then intermediate tree nodes will be removed from the
* tree if they contain 0 children after the leaf node is removed.
*/
removeLeafNode(targetIndex: number, prune?: boolean): void;
ascend(visitor: (node: PDFPageTree) => any): void;
/** Performs a Post-Order traversal of this page tree */
traverse(visitor: (node: TreeNode, ref: PDFRef) => any): void;
private insertLeafKid;
private removeKid;
}
export default PDFPageTree;
//# sourceMappingURL=PDFPageTree.d.ts.map

View File

@@ -0,0 +1,62 @@
declare enum CharCodes {
Null = 0,
Backspace = 8,
Tab = 9,
Newline = 10,
FormFeed = 12,
CarriageReturn = 13,
Space = 32,
ExclamationPoint = 33,
Hash = 35,
Percent = 37,
LeftParen = 40,
RightParen = 41,
Plus = 43,
Minus = 45,
Dash = 45,
Period = 46,
ForwardSlash = 47,
Zero = 48,
One = 49,
Two = 50,
Three = 51,
Four = 52,
Five = 53,
Six = 54,
Seven = 55,
Eight = 56,
Nine = 57,
LessThan = 60,
GreaterThan = 62,
A = 65,
D = 68,
E = 69,
F = 70,
O = 79,
P = 80,
R = 82,
LeftSquareBracket = 91,
BackSlash = 92,
RightSquareBracket = 93,
a = 97,
b = 98,
d = 100,
e = 101,
f = 102,
i = 105,
j = 106,
l = 108,
m = 109,
n = 110,
o = 111,
r = 114,
s = 115,
t = 116,
u = 117,
x = 120,
LeftCurly = 123,
RightCurly = 125,
Tilde = 126
}
export default CharCodes;
//# sourceMappingURL=CharCodes.d.ts.map

View File

@@ -0,0 +1,2 @@
export declare const IsDelimiter: Uint8Array;
//# sourceMappingURL=Delimiters.d.ts.map

View File

@@ -0,0 +1,2 @@
export declare const IsIrregular: Uint8Array;
//# sourceMappingURL=Irregular.d.ts.map

View File

@@ -0,0 +1,23 @@
import CharCodes from "./CharCodes";
export declare const Keywords: {
header: CharCodes[];
eof: CharCodes[];
obj: CharCodes[];
endobj: CharCodes[];
xref: CharCodes[];
trailer: CharCodes[];
startxref: CharCodes[];
true: CharCodes[];
false: CharCodes[];
null: CharCodes[];
stream: CharCodes[];
streamEOF1: CharCodes[];
streamEOF2: CharCodes[];
streamEOF3: CharCodes[];
streamEOF4: CharCodes[];
endstream: CharCodes[];
EOF1endstream: CharCodes[];
EOF2endstream: CharCodes[];
EOF3endstream: CharCodes[];
};
//# sourceMappingURL=Keywords.d.ts.map

View File

@@ -0,0 +1,4 @@
export declare const IsDigit: Uint8Array;
export declare const IsNumericPrefix: Uint8Array;
export declare const IsNumeric: Uint8Array;
//# sourceMappingURL=Numeric.d.ts.map

View File

@@ -0,0 +1,2 @@
export declare const IsWhitespace: Uint8Array;
//# sourceMappingURL=Whitespace.d.ts.map

View File

@@ -0,0 +1,20 @@
import PDFHeader from "../document/PDFHeader";
import PDFTrailer from "../document/PDFTrailer";
import PDFObject from "../objects/PDFObject";
import PDFRef from "../objects/PDFRef";
import PDFContext from "../PDFContext";
import PDFWriter from "./PDFWriter";
declare class PDFStreamWriter extends PDFWriter {
static forContext: (context: PDFContext, objectsPerTick: number, encodeStreams?: boolean, objectsPerStream?: number) => PDFStreamWriter;
private readonly encodeStreams;
private readonly objectsPerStream;
private constructor();
protected computeBufferSize(): Promise<{
size: number;
header: PDFHeader;
indirectObjects: [PDFRef, PDFObject][];
trailer: PDFTrailer;
}>;
}
export default PDFStreamWriter;
//# sourceMappingURL=PDFStreamWriter.d.ts.map

View File

@@ -0,0 +1,30 @@
import PDFCrossRefSection from "../document/PDFCrossRefSection";
import PDFHeader from "../document/PDFHeader";
import PDFTrailer from "../document/PDFTrailer";
import PDFTrailerDict from "../document/PDFTrailerDict";
import PDFDict from "../objects/PDFDict";
import PDFObject from "../objects/PDFObject";
import PDFRef from "../objects/PDFRef";
import PDFContext from "../PDFContext";
export interface SerializationInfo {
size: number;
header: PDFHeader;
indirectObjects: [PDFRef, PDFObject][];
xref?: PDFCrossRefSection;
trailerDict?: PDFTrailerDict;
trailer: PDFTrailer;
}
declare class PDFWriter {
static forContext: (context: PDFContext, objectsPerTick: number) => PDFWriter;
protected readonly context: PDFContext;
protected readonly objectsPerTick: number;
private parsedObjects;
protected constructor(context: PDFContext, objectsPerTick: number);
serializeToBuffer(): Promise<Uint8Array>;
protected computeIndirectObjectSize([ref, object]: [PDFRef, PDFObject]): number;
protected createTrailerDict(): PDFDict;
protected computeBufferSize(): Promise<SerializationInfo>;
protected shouldWaitForTick: (n: number) => boolean;
}
export default PDFWriter;
//# sourceMappingURL=PDFWriter.d.ts.map