first commit
This commit is contained in:
28
node_modules/pdf-lib/es/core/structures/PDFCatalog.d.ts
generated
vendored
Normal file
28
node_modules/pdf-lib/es/core/structures/PDFCatalog.d.ts
generated
vendored
Normal 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
|
||||
1
node_modules/pdf-lib/es/core/structures/PDFCatalog.d.ts.map
generated
vendored
Normal file
1
node_modules/pdf-lib/es/core/structures/PDFCatalog.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PDFCatalog.d.ts","sourceRoot":"","sources":["../../../src/core/structures/PDFCatalog.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,OAAO,EAAE,2BAAiC;AAE5D,OAAO,MAAM,0BAAgC;AAC7C,OAAO,UAAU,sBAA4B;AAC7C,OAAO,WAAW,sBAAwC;AAC1D,OAAO,EAAE,WAAW,EAAE,oBAA0B;AAChD,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AAEjE,cAAM,UAAW,SAAQ,OAAO;IAC9B,MAAM,CAAC,mBAAmB,YACf,UAAU,SACZ,WAAW,GAAG,MAAM,gBAM3B;IAEF,MAAM,CAAC,kBAAkB,0BAA2B,UAAU,gBAC/B;IAE/B,KAAK,IAAI,WAAW;IAIpB,QAAQ,IAAI,OAAO,GAAG,SAAS;IAI/B,WAAW,IAAI,WAAW,GAAG,SAAS;IAMtC,mBAAmB,IAAI,WAAW;IAUlC,iBAAiB,IAAI,OAAO,GAAG,SAAS;IAIxC,oBAAoB,IAAI,iBAAiB,GAAG,SAAS;IAMrD,4BAA4B,IAAI,iBAAiB;IAUjD;;;;;;OAMG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAMtD,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CAGpC;AAED,eAAe,UAAU,CAAC"}
|
||||
77
node_modules/pdf-lib/es/core/structures/PDFCatalog.js
generated
vendored
Normal file
77
node_modules/pdf-lib/es/core/structures/PDFCatalog.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
import { __extends } from "tslib";
|
||||
import PDFDict from "../objects/PDFDict";
|
||||
import PDFName from "../objects/PDFName";
|
||||
import { PDFAcroForm } from "../acroform";
|
||||
import ViewerPreferences from '../interactive/ViewerPreferences';
|
||||
var PDFCatalog = /** @class */ (function (_super) {
|
||||
__extends(PDFCatalog, _super);
|
||||
function PDFCatalog() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
PDFCatalog.prototype.Pages = function () {
|
||||
return this.lookup(PDFName.of('Pages'), PDFDict);
|
||||
};
|
||||
PDFCatalog.prototype.AcroForm = function () {
|
||||
return this.lookupMaybe(PDFName.of('AcroForm'), PDFDict);
|
||||
};
|
||||
PDFCatalog.prototype.getAcroForm = function () {
|
||||
var dict = this.AcroForm();
|
||||
if (!dict)
|
||||
return undefined;
|
||||
return PDFAcroForm.fromDict(dict);
|
||||
};
|
||||
PDFCatalog.prototype.getOrCreateAcroForm = function () {
|
||||
var acroForm = this.getAcroForm();
|
||||
if (!acroForm) {
|
||||
acroForm = PDFAcroForm.create(this.context);
|
||||
var acroFormRef = this.context.register(acroForm.dict);
|
||||
this.set(PDFName.of('AcroForm'), acroFormRef);
|
||||
}
|
||||
return acroForm;
|
||||
};
|
||||
PDFCatalog.prototype.ViewerPreferences = function () {
|
||||
return this.lookupMaybe(PDFName.of('ViewerPreferences'), PDFDict);
|
||||
};
|
||||
PDFCatalog.prototype.getViewerPreferences = function () {
|
||||
var dict = this.ViewerPreferences();
|
||||
if (!dict)
|
||||
return undefined;
|
||||
return ViewerPreferences.fromDict(dict);
|
||||
};
|
||||
PDFCatalog.prototype.getOrCreateViewerPreferences = function () {
|
||||
var viewerPrefs = this.getViewerPreferences();
|
||||
if (!viewerPrefs) {
|
||||
viewerPrefs = ViewerPreferences.create(this.context);
|
||||
var viewerPrefsRef = this.context.register(viewerPrefs.dict);
|
||||
this.set(PDFName.of('ViewerPreferences'), viewerPrefsRef);
|
||||
}
|
||||
return viewerPrefs;
|
||||
};
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
PDFCatalog.prototype.insertLeafNode = function (leafRef, index) {
|
||||
var pagesRef = this.get(PDFName.of('Pages'));
|
||||
var maybeParentRef = this.Pages().insertLeafNode(leafRef, index);
|
||||
return maybeParentRef || pagesRef;
|
||||
};
|
||||
PDFCatalog.prototype.removeLeafNode = function (index) {
|
||||
this.Pages().removeLeafNode(index);
|
||||
};
|
||||
PDFCatalog.withContextAndPages = function (context, pages) {
|
||||
var dict = new Map();
|
||||
dict.set(PDFName.of('Type'), PDFName.of('Catalog'));
|
||||
dict.set(PDFName.of('Pages'), pages);
|
||||
return new PDFCatalog(dict, context);
|
||||
};
|
||||
PDFCatalog.fromMapWithContext = function (map, context) {
|
||||
return new PDFCatalog(map, context);
|
||||
};
|
||||
return PDFCatalog;
|
||||
}(PDFDict));
|
||||
export default PDFCatalog;
|
||||
//# sourceMappingURL=PDFCatalog.js.map
|
||||
1
node_modules/pdf-lib/es/core/structures/PDFCatalog.js.map
generated
vendored
Normal file
1
node_modules/pdf-lib/es/core/structures/PDFCatalog.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PDFCatalog.js","sourceRoot":"","sources":["../../../src/core/structures/PDFCatalog.ts"],"names":[],"mappings":";AAAA,OAAO,OAAoB,2BAAiC;AAC5D,OAAO,OAAO,2BAAiC;AAI/C,OAAO,EAAE,WAAW,EAAE,oBAA0B;AAChD,OAAO,iBAAiB,MAAM,kCAAkC,CAAC;AAEjE;IAAyB,8BAAO;IAAhC;;IA0EA,CAAC;IA5DC,0BAAK,GAAL;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,CAAgB,CAAC;IAClE,CAAC;IAED,6BAAQ,GAAR;QACE,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,gCAAW,GAAX;QACE,IAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC7B,IAAI,CAAC,IAAI;YAAE,OAAO,SAAS,CAAC;QAC5B,OAAO,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,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GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,CAAW,CAAC;QACzD,IAAM,cAAc,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACnE,OAAO,cAAc,IAAI,QAAQ,CAAC;IACpC,CAAC;IAED,mCAAc,GAAd,UAAe,KAAa;QAC1B,IAAI,CAAC,KAAK,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAxEM,8BAAmB,GAAG,UAC3B,OAAmB,EACnB,KAA2B;QAE3B,IAAM,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;QACpD,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;QACrC,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC,CAAC;IAEK,6BAAkB,GAAG,UAAC,GAAY,EAAE,OAAmB;QAC5D,OAAA,IAAI,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC;IAA5B,CAA4B,CAAC;IA8DjC,iBAAC;CAAA,AA1ED,CAAyB,OAAO,GA0E/B;AAED,eAAe,UAAU,CAAC"}
|
||||
16
node_modules/pdf-lib/es/core/structures/PDFContentStream.d.ts
generated
vendored
Normal file
16
node_modules/pdf-lib/es/core/structures/PDFContentStream.d.ts
generated
vendored
Normal 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
|
||||
1
node_modules/pdf-lib/es/core/structures/PDFContentStream.d.ts.map
generated
vendored
Normal file
1
node_modules/pdf-lib/es/core/structures/PDFContentStream.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PDFContentStream.d.ts","sourceRoot":"","sources":["../../../src/core/structures/PDFContentStream.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,2BAAiC;AAC/C,OAAO,WAAW,iCAAuC;AACzD,OAAO,UAAU,sBAA4B;AAC7C,OAAO,cAAc,yBAA2C;AAGhE,cAAM,gBAAiB,SAAQ,cAAc;IAC3C,MAAM,CAAC,EAAE,SAAU,OAAO,aAAa,WAAW,EAAE,wCACJ;IAEhD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgB;IAE1C,OAAO;IAKP,IAAI,CAAC,GAAG,SAAS,EAAE,WAAW,EAAE,GAAG,IAAI;IAIvC,KAAK,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,gBAAgB;IAS7C,iBAAiB,IAAI,MAAM;IAQ3B,oBAAoB,IAAI,UAAU;IAUlC,wBAAwB,IAAI,MAAM;CAOnC;AAED,eAAe,gBAAgB,CAAC"}
|
||||
58
node_modules/pdf-lib/es/core/structures/PDFContentStream.js
generated
vendored
Normal file
58
node_modules/pdf-lib/es/core/structures/PDFContentStream.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
import { __extends } from "tslib";
|
||||
import PDFFlateStream from "./PDFFlateStream";
|
||||
import CharCodes from "../syntax/CharCodes";
|
||||
var PDFContentStream = /** @class */ (function (_super) {
|
||||
__extends(PDFContentStream, _super);
|
||||
function PDFContentStream(dict, operators, encode) {
|
||||
if (encode === void 0) { encode = true; }
|
||||
var _this = _super.call(this, dict, encode) || this;
|
||||
_this.operators = operators;
|
||||
return _this;
|
||||
}
|
||||
PDFContentStream.prototype.push = function () {
|
||||
var _a;
|
||||
var operators = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
operators[_i] = arguments[_i];
|
||||
}
|
||||
(_a = this.operators).push.apply(_a, operators);
|
||||
};
|
||||
PDFContentStream.prototype.clone = function (context) {
|
||||
var operators = new Array(this.operators.length);
|
||||
for (var idx = 0, len = this.operators.length; idx < len; idx++) {
|
||||
operators[idx] = this.operators[idx].clone(context);
|
||||
}
|
||||
var _a = this, dict = _a.dict, encode = _a.encode;
|
||||
return PDFContentStream.of(dict.clone(context), operators, encode);
|
||||
};
|
||||
PDFContentStream.prototype.getContentsString = function () {
|
||||
var value = '';
|
||||
for (var idx = 0, len = this.operators.length; idx < len; idx++) {
|
||||
value += this.operators[idx] + "\n";
|
||||
}
|
||||
return value;
|
||||
};
|
||||
PDFContentStream.prototype.getUnencodedContents = function () {
|
||||
var buffer = new Uint8Array(this.getUnencodedContentsSize());
|
||||
var offset = 0;
|
||||
for (var idx = 0, len = this.operators.length; idx < len; idx++) {
|
||||
offset += this.operators[idx].copyBytesInto(buffer, offset);
|
||||
buffer[offset++] = CharCodes.Newline;
|
||||
}
|
||||
return buffer;
|
||||
};
|
||||
PDFContentStream.prototype.getUnencodedContentsSize = function () {
|
||||
var size = 0;
|
||||
for (var idx = 0, len = this.operators.length; idx < len; idx++) {
|
||||
size += this.operators[idx].sizeInBytes() + 1;
|
||||
}
|
||||
return size;
|
||||
};
|
||||
PDFContentStream.of = function (dict, operators, encode) {
|
||||
if (encode === void 0) { encode = true; }
|
||||
return new PDFContentStream(dict, operators, encode);
|
||||
};
|
||||
return PDFContentStream;
|
||||
}(PDFFlateStream));
|
||||
export default PDFContentStream;
|
||||
//# sourceMappingURL=PDFContentStream.js.map
|
||||
1
node_modules/pdf-lib/es/core/structures/PDFContentStream.js.map
generated
vendored
Normal file
1
node_modules/pdf-lib/es/core/structures/PDFContentStream.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PDFContentStream.js","sourceRoot":"","sources":["../../../src/core/structures/PDFContentStream.ts"],"names":[],"mappings":";AAGA,OAAO,cAAc,yBAA2C;AAChE,OAAO,SAAS,4BAAkC;AAElD;IAA+B,oCAAc;IAM3C,0BAAoB,IAAa,EAAE,SAAwB,EAAE,MAAa;QAAb,uBAAA,EAAA,aAAa;QAA1E,YACE,kBAAM,IAAI,EAAE,MAAM,CAAC,SAEpB;QADC,KAAI,CAAC,SAAS,GAAG,SAAS,CAAC;;IAC7B,CAAC;IAED,+BAAI,GAAJ;;QAAK,mBAA2B;aAA3B,UAA2B,EAA3B,qBAA2B,EAA3B,IAA2B;YAA3B,8BAA2B;;QAC9B,CAAA,KAAA,IAAI,CAAC,SAAS,CAAA,CAAC,IAAI,WAAI,SAAS,EAAE;IACpC,CAAC;IAED,gCAAK,GAAL,UAAM,OAAoB;QACxB,IAAM,SAAS,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACnD,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;YAC/D,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;SACrD;QACK,IAAA,KAAmB,IAAI,EAArB,IAAI,UAAA,EAAE,MAAM,YAAS,CAAC;QAC9B,OAAO,gBAAgB,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACrE,CAAC;IAED,4CAAiB,GAAjB;QACE,IAAI,KA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+ClD,uBAAC;CAAA,AAjDD,CAA+B,cAAc,GAiD5C;AAED,eAAe,gBAAgB,CAAC"}
|
||||
54
node_modules/pdf-lib/es/core/structures/PDFCrossRefStream.d.ts
generated
vendored
Normal file
54
node_modules/pdf-lib/es/core/structures/PDFCrossRefStream.d.ts
generated
vendored
Normal 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
|
||||
1
node_modules/pdf-lib/es/core/structures/PDFCrossRefStream.d.ts.map
generated
vendored
Normal file
1
node_modules/pdf-lib/es/core/structures/PDFCrossRefStream.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PDFCrossRefStream.d.ts","sourceRoot":"","sources":["../../../src/core/structures/PDFCrossRefStream.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,2BAAiC;AAE/C,OAAO,MAAM,0BAAgC;AAC7C,OAAO,UAAU,sBAA4B;AAC7C,OAAO,cAAc,yBAA2C;AAGhE,oBAAY,SAAS;IACnB,OAAO,IAAI;IACX,YAAY,IAAI;IAChB,UAAU,IAAI;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,SAAS,CAAC,YAAY,CAAC;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,CAAC,UAAU,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,oBAAY,KAAK,GAAG,YAAY,GAAG,iBAAiB,GAAG,eAAe,CAAC;AAEvE,oBAAY,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAElD;;;;GAIG;AACH,cAAM,iBAAkB,SAAQ,cAAc;IAC5C,MAAM,CAAC,MAAM,SAAU,OAAO,yCAI5B;IAEF,MAAM,CAAC,EAAE,SAAU,OAAO,WAAW,KAAK,EAAE,yCACG;IAE/C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAClC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAsB;IACvD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAkC;IACrE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkB;IAE7C,OAAO;IAWP,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM;IASzD,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAShD,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAStE,KAAK,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,iBAAiB;IAK9C,iBAAiB,IAAI,MAAM;IA8B3B,oBAAoB,IAAI,UAAU;IA+BlC,wBAAwB,IAAI,MAAM;IAMlC,UAAU,IAAI,IAAI;IAclB,OAAO,CAAC,YAAY,CAqBlB;IAEF,OAAO,CAAC,kBAAkB,CAoBxB;IAEF,OAAO,CAAC,yBAAyB,CAiB/B;CACH;AAED,eAAe,iBAAiB,CAAC"}
|
||||
184
node_modules/pdf-lib/es/core/structures/PDFCrossRefStream.js
generated
vendored
Normal file
184
node_modules/pdf-lib/es/core/structures/PDFCrossRefStream.js
generated
vendored
Normal file
@@ -0,0 +1,184 @@
|
||||
import { __extends } from "tslib";
|
||||
import PDFName from "../objects/PDFName";
|
||||
import PDFRef from "../objects/PDFRef";
|
||||
import PDFFlateStream from "./PDFFlateStream";
|
||||
import { bytesFor, Cache, reverseArray, sizeInBytes, sum } from "../../utils";
|
||||
export var EntryType;
|
||||
(function (EntryType) {
|
||||
EntryType[EntryType["Deleted"] = 0] = "Deleted";
|
||||
EntryType[EntryType["Uncompressed"] = 1] = "Uncompressed";
|
||||
EntryType[EntryType["Compressed"] = 2] = "Compressed";
|
||||
})(EntryType || (EntryType = {}));
|
||||
/**
|
||||
* Entries should be added using the [[addDeletedEntry]],
|
||||
* [[addUncompressedEntry]], and [[addCompressedEntry]] methods
|
||||
* **in order of ascending object number**.
|
||||
*/
|
||||
var PDFCrossRefStream = /** @class */ (function (_super) {
|
||||
__extends(PDFCrossRefStream, _super);
|
||||
function PDFCrossRefStream(dict, entries, encode) {
|
||||
if (encode === void 0) { encode = true; }
|
||||
var _this = _super.call(this, dict, encode) || this;
|
||||
// Returns an array of integer pairs for each subsection of the cross ref
|
||||
// section, where each integer pair represents:
|
||||
// firstObjectNumber(OfSection), length(OfSection)
|
||||
_this.computeIndex = function () {
|
||||
var subsections = [];
|
||||
var subsectionLength = 0;
|
||||
for (var idx = 0, len = _this.entries.length; idx < len; idx++) {
|
||||
var currEntry = _this.entries[idx];
|
||||
var prevEntry = _this.entries[idx - 1];
|
||||
if (idx === 0) {
|
||||
subsections.push(currEntry.ref.objectNumber);
|
||||
}
|
||||
else if (currEntry.ref.objectNumber - prevEntry.ref.objectNumber > 1) {
|
||||
subsections.push(subsectionLength);
|
||||
subsections.push(currEntry.ref.objectNumber);
|
||||
subsectionLength = 0;
|
||||
}
|
||||
subsectionLength += 1;
|
||||
}
|
||||
subsections.push(subsectionLength);
|
||||
return subsections;
|
||||
};
|
||||
_this.computeEntryTuples = function () {
|
||||
var entryTuples = new Array(_this.entries.length);
|
||||
for (var idx = 0, len = _this.entries.length; idx < len; idx++) {
|
||||
var entry = _this.entries[idx];
|
||||
if (entry.type === EntryType.Deleted) {
|
||||
var type = entry.type, nextFreeObjectNumber = entry.nextFreeObjectNumber, ref = entry.ref;
|
||||
entryTuples[idx] = [type, nextFreeObjectNumber, ref.generationNumber];
|
||||
}
|
||||
if (entry.type === EntryType.Uncompressed) {
|
||||
var type = entry.type, offset = entry.offset, ref = entry.ref;
|
||||
entryTuples[idx] = [type, offset, ref.generationNumber];
|
||||
}
|
||||
if (entry.type === EntryType.Compressed) {
|
||||
var type = entry.type, objectStreamRef = entry.objectStreamRef, index = entry.index;
|
||||
entryTuples[idx] = [type, objectStreamRef.objectNumber, index];
|
||||
}
|
||||
}
|
||||
return entryTuples;
|
||||
};
|
||||
_this.computeMaxEntryByteWidths = function () {
|
||||
var entryTuples = _this.entryTuplesCache.access();
|
||||
var widths = [0, 0, 0];
|
||||
for (var idx = 0, len = entryTuples.length; idx < len; idx++) {
|
||||
var _a = entryTuples[idx], first = _a[0], second = _a[1], third = _a[2];
|
||||
var firstSize = sizeInBytes(first);
|
||||
var secondSize = sizeInBytes(second);
|
||||
var thirdSize = sizeInBytes(third);
|
||||
if (firstSize > widths[0])
|
||||
widths[0] = firstSize;
|
||||
if (secondSize > widths[1])
|
||||
widths[1] = secondSize;
|
||||
if (thirdSize > widths[2])
|
||||
widths[2] = thirdSize;
|
||||
}
|
||||
return widths;
|
||||
};
|
||||
_this.entries = entries || [];
|
||||
_this.entryTuplesCache = Cache.populatedBy(_this.computeEntryTuples);
|
||||
_this.maxByteWidthsCache = Cache.populatedBy(_this.computeMaxEntryByteWidths);
|
||||
_this.indexCache = Cache.populatedBy(_this.computeIndex);
|
||||
dict.set(PDFName.of('Type'), PDFName.of('XRef'));
|
||||
return _this;
|
||||
}
|
||||
PDFCrossRefStream.prototype.addDeletedEntry = function (ref, nextFreeObjectNumber) {
|
||||
var type = EntryType.Deleted;
|
||||
this.entries.push({ type: type, ref: ref, nextFreeObjectNumber: nextFreeObjectNumber });
|
||||
this.entryTuplesCache.invalidate();
|
||||
this.maxByteWidthsCache.invalidate();
|
||||
this.indexCache.invalidate();
|
||||
this.contentsCache.invalidate();
|
||||
};
|
||||
PDFCrossRefStream.prototype.addUncompressedEntry = function (ref, offset) {
|
||||
var type = EntryType.Uncompressed;
|
||||
this.entries.push({ type: type, ref: ref, offset: offset });
|
||||
this.entryTuplesCache.invalidate();
|
||||
this.maxByteWidthsCache.invalidate();
|
||||
this.indexCache.invalidate();
|
||||
this.contentsCache.invalidate();
|
||||
};
|
||||
PDFCrossRefStream.prototype.addCompressedEntry = function (ref, objectStreamRef, index) {
|
||||
var type = EntryType.Compressed;
|
||||
this.entries.push({ type: type, ref: ref, objectStreamRef: objectStreamRef, index: index });
|
||||
this.entryTuplesCache.invalidate();
|
||||
this.maxByteWidthsCache.invalidate();
|
||||
this.indexCache.invalidate();
|
||||
this.contentsCache.invalidate();
|
||||
};
|
||||
PDFCrossRefStream.prototype.clone = function (context) {
|
||||
var _a = this, dict = _a.dict, entries = _a.entries, encode = _a.encode;
|
||||
return PDFCrossRefStream.of(dict.clone(context), entries.slice(), encode);
|
||||
};
|
||||
PDFCrossRefStream.prototype.getContentsString = function () {
|
||||
var entryTuples = this.entryTuplesCache.access();
|
||||
var byteWidths = this.maxByteWidthsCache.access();
|
||||
var value = '';
|
||||
for (var entryIdx = 0, entriesLen = entryTuples.length; entryIdx < entriesLen; entryIdx++) {
|
||||
var _a = entryTuples[entryIdx], first = _a[0], second = _a[1], third = _a[2];
|
||||
var firstBytes = reverseArray(bytesFor(first));
|
||||
var secondBytes = reverseArray(bytesFor(second));
|
||||
var thirdBytes = reverseArray(bytesFor(third));
|
||||
for (var idx = byteWidths[0] - 1; idx >= 0; idx--) {
|
||||
value += (firstBytes[idx] || 0).toString(2);
|
||||
}
|
||||
for (var idx = byteWidths[1] - 1; idx >= 0; idx--) {
|
||||
value += (secondBytes[idx] || 0).toString(2);
|
||||
}
|
||||
for (var idx = byteWidths[2] - 1; idx >= 0; idx--) {
|
||||
value += (thirdBytes[idx] || 0).toString(2);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
};
|
||||
PDFCrossRefStream.prototype.getUnencodedContents = function () {
|
||||
var entryTuples = this.entryTuplesCache.access();
|
||||
var byteWidths = this.maxByteWidthsCache.access();
|
||||
var buffer = new Uint8Array(this.getUnencodedContentsSize());
|
||||
var offset = 0;
|
||||
for (var entryIdx = 0, entriesLen = entryTuples.length; entryIdx < entriesLen; entryIdx++) {
|
||||
var _a = entryTuples[entryIdx], first = _a[0], second = _a[1], third = _a[2];
|
||||
var firstBytes = reverseArray(bytesFor(first));
|
||||
var secondBytes = reverseArray(bytesFor(second));
|
||||
var thirdBytes = reverseArray(bytesFor(third));
|
||||
for (var idx = byteWidths[0] - 1; idx >= 0; idx--) {
|
||||
buffer[offset++] = firstBytes[idx] || 0;
|
||||
}
|
||||
for (var idx = byteWidths[1] - 1; idx >= 0; idx--) {
|
||||
buffer[offset++] = secondBytes[idx] || 0;
|
||||
}
|
||||
for (var idx = byteWidths[2] - 1; idx >= 0; idx--) {
|
||||
buffer[offset++] = thirdBytes[idx] || 0;
|
||||
}
|
||||
}
|
||||
return buffer;
|
||||
};
|
||||
PDFCrossRefStream.prototype.getUnencodedContentsSize = function () {
|
||||
var byteWidths = this.maxByteWidthsCache.access();
|
||||
var entryWidth = sum(byteWidths);
|
||||
return entryWidth * this.entries.length;
|
||||
};
|
||||
PDFCrossRefStream.prototype.updateDict = function () {
|
||||
_super.prototype.updateDict.call(this);
|
||||
var byteWidths = this.maxByteWidthsCache.access();
|
||||
var index = this.indexCache.access();
|
||||
var context = this.dict.context;
|
||||
this.dict.set(PDFName.of('W'), context.obj(byteWidths));
|
||||
this.dict.set(PDFName.of('Index'), context.obj(index));
|
||||
};
|
||||
PDFCrossRefStream.create = function (dict, encode) {
|
||||
if (encode === void 0) { encode = true; }
|
||||
var stream = new PDFCrossRefStream(dict, [], encode);
|
||||
stream.addDeletedEntry(PDFRef.of(0, 65535), 0);
|
||||
return stream;
|
||||
};
|
||||
PDFCrossRefStream.of = function (dict, entries, encode) {
|
||||
if (encode === void 0) { encode = true; }
|
||||
return new PDFCrossRefStream(dict, entries, encode);
|
||||
};
|
||||
return PDFCrossRefStream;
|
||||
}(PDFFlateStream));
|
||||
export default PDFCrossRefStream;
|
||||
//# sourceMappingURL=PDFCrossRefStream.js.map
|
||||
1
node_modules/pdf-lib/es/core/structures/PDFCrossRefStream.js.map
generated
vendored
Normal file
1
node_modules/pdf-lib/es/core/structures/PDFCrossRefStream.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
14
node_modules/pdf-lib/es/core/structures/PDFFlateStream.d.ts
generated
vendored
Normal file
14
node_modules/pdf-lib/es/core/structures/PDFFlateStream.d.ts
generated
vendored
Normal 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
|
||||
1
node_modules/pdf-lib/es/core/structures/PDFFlateStream.d.ts.map
generated
vendored
Normal file
1
node_modules/pdf-lib/es/core/structures/PDFFlateStream.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PDFFlateStream.d.ts","sourceRoot":"","sources":["../../../src/core/structures/PDFFlateStream.ts"],"names":[],"mappings":"AAGA,OAAO,OAAO,2BAAiC;AAE/C,OAAO,SAAS,6BAAmC;AACnD,OAAO,EAAE,KAAK,EAAE,oBAAkB;AAElC,cAAM,cAAe,SAAQ,SAAS;IACpC,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IACpD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;gBAEvB,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO;IAS1C,eAAe,QAAO,UAAU,CAG9B;IAEF,WAAW,IAAI,UAAU;IAIzB,eAAe,IAAI,MAAM;IAIzB,oBAAoB,IAAI,UAAU;CAMnC;AAED,eAAe,cAAc,CAAC"}
|
||||
33
node_modules/pdf-lib/es/core/structures/PDFFlateStream.js
generated
vendored
Normal file
33
node_modules/pdf-lib/es/core/structures/PDFFlateStream.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { __extends } from "tslib";
|
||||
import pako from 'pako';
|
||||
import { MethodNotImplementedError } from "../errors";
|
||||
import PDFName from "../objects/PDFName";
|
||||
import PDFStream from "../objects/PDFStream";
|
||||
import { Cache } from "../../utils";
|
||||
var PDFFlateStream = /** @class */ (function (_super) {
|
||||
__extends(PDFFlateStream, _super);
|
||||
function PDFFlateStream(dict, encode) {
|
||||
var _this = _super.call(this, dict) || this;
|
||||
_this.computeContents = function () {
|
||||
var unencodedContents = _this.getUnencodedContents();
|
||||
return _this.encode ? pako.deflate(unencodedContents) : unencodedContents;
|
||||
};
|
||||
_this.encode = encode;
|
||||
if (encode)
|
||||
dict.set(PDFName.of('Filter'), PDFName.of('FlateDecode'));
|
||||
_this.contentsCache = Cache.populatedBy(_this.computeContents);
|
||||
return _this;
|
||||
}
|
||||
PDFFlateStream.prototype.getContents = function () {
|
||||
return this.contentsCache.access();
|
||||
};
|
||||
PDFFlateStream.prototype.getContentsSize = function () {
|
||||
return this.contentsCache.access().length;
|
||||
};
|
||||
PDFFlateStream.prototype.getUnencodedContents = function () {
|
||||
throw new MethodNotImplementedError(this.constructor.name, 'getUnencodedContents');
|
||||
};
|
||||
return PDFFlateStream;
|
||||
}(PDFStream));
|
||||
export default PDFFlateStream;
|
||||
//# sourceMappingURL=PDFFlateStream.js.map
|
||||
1
node_modules/pdf-lib/es/core/structures/PDFFlateStream.js.map
generated
vendored
Normal file
1
node_modules/pdf-lib/es/core/structures/PDFFlateStream.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PDFFlateStream.js","sourceRoot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generated
vendored
Normal file
21
node_modules/pdf-lib/es/core/structures/PDFObjectStream.d.ts
generated
vendored
Normal 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
|
||||
1
node_modules/pdf-lib/es/core/structures/PDFObjectStream.d.ts.map
generated
vendored
Normal file
1
node_modules/pdf-lib/es/core/structures/PDFObjectStream.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PDFObjectStream.d.ts","sourceRoot":"","sources":["../../../src/core/structures/PDFObjectStream.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,6BAAmC;AACnD,OAAO,MAAM,0BAAgC;AAC7C,OAAO,UAAU,sBAA4B;AAC7C,OAAO,cAAc,yBAA2C;AAIhE,oBAAY,cAAc,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAEjD,cAAM,eAAgB,SAAQ,cAAc;IAC1C,MAAM,CAAC,qBAAqB,YACjB,UAAU,WACV,cAAc,EAAE,uCAEwB;IAEnD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IAEvC,OAAO;IAgBP,eAAe,IAAI,MAAM;IAIzB,KAAK,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,eAAe;IAQ5C,iBAAiB,IAAI,MAAM;IAS3B,oBAAoB,IAAI,UAAU;IAWlC,wBAAwB,IAAI,MAAM;IASlC,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,oBAAoB;CAU7B;AAED,eAAe,eAAe,CAAC"}
|
||||
75
node_modules/pdf-lib/es/core/structures/PDFObjectStream.js
generated
vendored
Normal file
75
node_modules/pdf-lib/es/core/structures/PDFObjectStream.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
import { __extends } from "tslib";
|
||||
import PDFName from "../objects/PDFName";
|
||||
import PDFNumber from "../objects/PDFNumber";
|
||||
import PDFFlateStream from "./PDFFlateStream";
|
||||
import CharCodes from "../syntax/CharCodes";
|
||||
import { copyStringIntoBuffer, last } from "../../utils";
|
||||
var PDFObjectStream = /** @class */ (function (_super) {
|
||||
__extends(PDFObjectStream, _super);
|
||||
function PDFObjectStream(context, objects, encode) {
|
||||
if (encode === void 0) { encode = true; }
|
||||
var _this = _super.call(this, context.obj({}), encode) || this;
|
||||
_this.objects = objects;
|
||||
_this.offsets = _this.computeObjectOffsets();
|
||||
_this.offsetsString = _this.computeOffsetsString();
|
||||
_this.dict.set(PDFName.of('Type'), PDFName.of('ObjStm'));
|
||||
_this.dict.set(PDFName.of('N'), PDFNumber.of(_this.objects.length));
|
||||
_this.dict.set(PDFName.of('First'), PDFNumber.of(_this.offsetsString.length));
|
||||
return _this;
|
||||
}
|
||||
PDFObjectStream.prototype.getObjectsCount = function () {
|
||||
return this.objects.length;
|
||||
};
|
||||
PDFObjectStream.prototype.clone = function (context) {
|
||||
return PDFObjectStream.withContextAndObjects(context || this.dict.context, this.objects.slice(), this.encode);
|
||||
};
|
||||
PDFObjectStream.prototype.getContentsString = function () {
|
||||
var value = this.offsetsString;
|
||||
for (var idx = 0, len = this.objects.length; idx < len; idx++) {
|
||||
var _a = this.objects[idx], object = _a[1];
|
||||
value += object + "\n";
|
||||
}
|
||||
return value;
|
||||
};
|
||||
PDFObjectStream.prototype.getUnencodedContents = function () {
|
||||
var buffer = new Uint8Array(this.getUnencodedContentsSize());
|
||||
var offset = copyStringIntoBuffer(this.offsetsString, buffer, 0);
|
||||
for (var idx = 0, len = this.objects.length; idx < len; idx++) {
|
||||
var _a = this.objects[idx], object = _a[1];
|
||||
offset += object.copyBytesInto(buffer, offset);
|
||||
buffer[offset++] = CharCodes.Newline;
|
||||
}
|
||||
return buffer;
|
||||
};
|
||||
PDFObjectStream.prototype.getUnencodedContentsSize = function () {
|
||||
return (this.offsetsString.length +
|
||||
last(this.offsets)[1] +
|
||||
last(this.objects)[1].sizeInBytes() +
|
||||
1);
|
||||
};
|
||||
PDFObjectStream.prototype.computeOffsetsString = function () {
|
||||
var offsetsString = '';
|
||||
for (var idx = 0, len = this.offsets.length; idx < len; idx++) {
|
||||
var _a = this.offsets[idx], objectNumber = _a[0], offset = _a[1];
|
||||
offsetsString += objectNumber + " " + offset + " ";
|
||||
}
|
||||
return offsetsString;
|
||||
};
|
||||
PDFObjectStream.prototype.computeObjectOffsets = function () {
|
||||
var offset = 0;
|
||||
var offsets = new Array(this.objects.length);
|
||||
for (var idx = 0, len = this.objects.length; idx < len; idx++) {
|
||||
var _a = this.objects[idx], ref = _a[0], object = _a[1];
|
||||
offsets[idx] = [ref.objectNumber, offset];
|
||||
offset += object.sizeInBytes() + 1; // '\n'
|
||||
}
|
||||
return offsets;
|
||||
};
|
||||
PDFObjectStream.withContextAndObjects = function (context, objects, encode) {
|
||||
if (encode === void 0) { encode = true; }
|
||||
return new PDFObjectStream(context, objects, encode);
|
||||
};
|
||||
return PDFObjectStream;
|
||||
}(PDFFlateStream));
|
||||
export default PDFObjectStream;
|
||||
//# sourceMappingURL=PDFObjectStream.js.map
|
||||
1
node_modules/pdf-lib/es/core/structures/PDFObjectStream.js.map
generated
vendored
Normal file
1
node_modules/pdf-lib/es/core/structures/PDFObjectStream.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PDFObjectStream.js","sourceRoot":"","sources":["../../../src/core/structures/PDFObjectStream.ts"],"names":[],"mappings":";AAAA,OAAO,OAAO,2BAAiC;AAC/C,OAAO,SAAS,6BAAmC;AAInD,OAAO,cAAc,yBAA2C;AAChE,OAAO,SAAS,4BAAkC;AAClD,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,oBAAkB;AAIvD;IAA8B,mCAAc;IAW1C,yBACE,OAAmB,EACnB,OAAyB,EACzB,MAAa;QAAb,uBAAA,EAAA,aAAa;QAHf,YAKE,kBAAM,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,SAS/B;QAPC,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,KAAI,CAAC,OAAO,GAAG,KAAI,CAAC,oBAAoB,EAAE,CAAC;QAC3C,KAAI,CAAC,aAAa,GAAG,KAAI,CAAC,oBAAoB,EAAE,CAAC;QAEjD,KAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;QACxD,KAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC,KAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QAClE,KAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC,KAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;;IAC9E,CAAC;IAED,yCAAe,GAAf;QACE,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC7B,CAAC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E,OAAO,EAAE,MAAM,CAAC;IAA7C,CAA6C,CAAC;IAkFrD,sBAAC;CAAA,AAvFD,CAA8B,cAAc,GAuF3C;AAED,eAAe,eAAe,CAAC"}
|
||||
55
node_modules/pdf-lib/es/core/structures/PDFPageLeaf.d.ts
generated
vendored
Normal file
55
node_modules/pdf-lib/es/core/structures/PDFPageLeaf.d.ts
generated
vendored
Normal 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
|
||||
1
node_modules/pdf-lib/es/core/structures/PDFPageLeaf.d.ts.map
generated
vendored
Normal file
1
node_modules/pdf-lib/es/core/structures/PDFPageLeaf.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PDFPageLeaf.d.ts","sourceRoot":"","sources":["../../../src/core/structures/PDFPageLeaf.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,4BAAkC;AACjD,OAAO,OAAO,EAAE,EAAE,OAAO,EAAE,2BAAiC;AAC5D,OAAO,OAAO,2BAAiC;AAC/C,OAAO,SAAS,6BAAmC;AACnD,OAAO,SAAS,6BAAmC;AACnD,OAAO,MAAM,0BAAgC;AAC7C,OAAO,SAAS,6BAAmC;AACnD,OAAO,UAAU,sBAA4B;AAC7C,OAAO,WAAW,sBAAwC;AAE1D,cAAM,WAAY,SAAQ,OAAO;IAC/B,MAA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AAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAKnD,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAKnC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO;IAMpD,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI;IAKjE,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAKrC,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO;IAMlE,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,KAAK,GAAG,GAAG,IAAI;IAM/D,SAAS;IA6CT,iBAAiB;;;;;;;;CAclB;AAED,eAAe,WAAW,CAAC"}
|
||||
204
node_modules/pdf-lib/es/core/structures/PDFPageLeaf.js
generated
vendored
Normal file
204
node_modules/pdf-lib/es/core/structures/PDFPageLeaf.js
generated
vendored
Normal file
@@ -0,0 +1,204 @@
|
||||
import { __extends } from "tslib";
|
||||
import PDFArray from "../objects/PDFArray";
|
||||
import PDFDict from "../objects/PDFDict";
|
||||
import PDFName from "../objects/PDFName";
|
||||
import PDFNumber from "../objects/PDFNumber";
|
||||
import PDFStream from "../objects/PDFStream";
|
||||
var PDFPageLeaf = /** @class */ (function (_super) {
|
||||
__extends(PDFPageLeaf, _super);
|
||||
function PDFPageLeaf(map, context, autoNormalizeCTM) {
|
||||
if (autoNormalizeCTM === void 0) { autoNormalizeCTM = true; }
|
||||
var _this = _super.call(this, map, context) || this;
|
||||
_this.normalized = false;
|
||||
_this.autoNormalizeCTM = autoNormalizeCTM;
|
||||
return _this;
|
||||
}
|
||||
PDFPageLeaf.prototype.clone = function (context) {
|
||||
var clone = PDFPageLeaf.fromMapWithContext(new Map(), context || this.context, this.autoNormalizeCTM);
|
||||
var entries = this.entries();
|
||||
for (var idx = 0, len = entries.length; idx < len; idx++) {
|
||||
var _a = entries[idx], key = _a[0], value = _a[1];
|
||||
clone.set(key, value);
|
||||
}
|
||||
return clone;
|
||||
};
|
||||
PDFPageLeaf.prototype.Parent = function () {
|
||||
return this.lookupMaybe(PDFName.Parent, PDFDict);
|
||||
};
|
||||
PDFPageLeaf.prototype.Contents = function () {
|
||||
return this.lookup(PDFName.of('Contents'));
|
||||
};
|
||||
PDFPageLeaf.prototype.Annots = function () {
|
||||
return this.lookupMaybe(PDFName.Annots, PDFArray);
|
||||
};
|
||||
PDFPageLeaf.prototype.BleedBox = function () {
|
||||
return this.lookupMaybe(PDFName.BleedBox, PDFArray);
|
||||
};
|
||||
PDFPageLeaf.prototype.TrimBox = function () {
|
||||
return this.lookupMaybe(PDFName.TrimBox, PDFArray);
|
||||
};
|
||||
PDFPageLeaf.prototype.ArtBox = function () {
|
||||
return this.lookupMaybe(PDFName.ArtBox, PDFArray);
|
||||
};
|
||||
PDFPageLeaf.prototype.Resources = function () {
|
||||
var dictOrRef = this.getInheritableAttribute(PDFName.Resources);
|
||||
return this.context.lookupMaybe(dictOrRef, PDFDict);
|
||||
};
|
||||
PDFPageLeaf.prototype.MediaBox = function () {
|
||||
var arrayOrRef = this.getInheritableAttribute(PDFName.MediaBox);
|
||||
return this.context.lookup(arrayOrRef, PDFArray);
|
||||
};
|
||||
PDFPageLeaf.prototype.CropBox = function () {
|
||||
var arrayOrRef = this.getInheritableAttribute(PDFName.CropBox);
|
||||
return this.context.lookupMaybe(arrayOrRef, PDFArray);
|
||||
};
|
||||
PDFPageLeaf.prototype.Rotate = function () {
|
||||
var numberOrRef = this.getInheritableAttribute(PDFName.Rotate);
|
||||
return this.context.lookupMaybe(numberOrRef, PDFNumber);
|
||||
};
|
||||
PDFPageLeaf.prototype.getInheritableAttribute = function (name) {
|
||||
var attribute;
|
||||
this.ascend(function (node) {
|
||||
if (!attribute)
|
||||
attribute = node.get(name);
|
||||
});
|
||||
return attribute;
|
||||
};
|
||||
PDFPageLeaf.prototype.setParent = function (parentRef) {
|
||||
this.set(PDFName.Parent, parentRef);
|
||||
};
|
||||
PDFPageLeaf.prototype.addContentStream = function (contentStreamRef) {
|
||||
var Contents = this.normalizedEntries().Contents || this.context.obj([]);
|
||||
this.set(PDFName.Contents, Contents);
|
||||
Contents.push(contentStreamRef);
|
||||
};
|
||||
PDFPageLeaf.prototype.wrapContentStreams = function (startStream, endStream) {
|
||||
var Contents = this.Contents();
|
||||
if (Contents instanceof PDFArray) {
|
||||
Contents.insert(0, startStream);
|
||||
Contents.push(endStream);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
PDFPageLeaf.prototype.addAnnot = function (annotRef) {
|
||||
var Annots = this.normalizedEntries().Annots;
|
||||
Annots.push(annotRef);
|
||||
};
|
||||
PDFPageLeaf.prototype.removeAnnot = function (annotRef) {
|
||||
var Annots = this.normalizedEntries().Annots;
|
||||
var index = Annots.indexOf(annotRef);
|
||||
if (index !== undefined) {
|
||||
Annots.remove(index);
|
||||
}
|
||||
};
|
||||
PDFPageLeaf.prototype.setFontDictionary = function (name, fontDictRef) {
|
||||
var Font = this.normalizedEntries().Font;
|
||||
Font.set(name, fontDictRef);
|
||||
};
|
||||
PDFPageLeaf.prototype.newFontDictionaryKey = function (tag) {
|
||||
var Font = this.normalizedEntries().Font;
|
||||
return Font.uniqueKey(tag);
|
||||
};
|
||||
PDFPageLeaf.prototype.newFontDictionary = function (tag, fontDictRef) {
|
||||
var key = this.newFontDictionaryKey(tag);
|
||||
this.setFontDictionary(key, fontDictRef);
|
||||
return key;
|
||||
};
|
||||
PDFPageLeaf.prototype.setXObject = function (name, xObjectRef) {
|
||||
var XObject = this.normalizedEntries().XObject;
|
||||
XObject.set(name, xObjectRef);
|
||||
};
|
||||
PDFPageLeaf.prototype.newXObjectKey = function (tag) {
|
||||
var XObject = this.normalizedEntries().XObject;
|
||||
return XObject.uniqueKey(tag);
|
||||
};
|
||||
PDFPageLeaf.prototype.newXObject = function (tag, xObjectRef) {
|
||||
var key = this.newXObjectKey(tag);
|
||||
this.setXObject(key, xObjectRef);
|
||||
return key;
|
||||
};
|
||||
PDFPageLeaf.prototype.setExtGState = function (name, extGStateRef) {
|
||||
var ExtGState = this.normalizedEntries().ExtGState;
|
||||
ExtGState.set(name, extGStateRef);
|
||||
};
|
||||
PDFPageLeaf.prototype.newExtGStateKey = function (tag) {
|
||||
var ExtGState = this.normalizedEntries().ExtGState;
|
||||
return ExtGState.uniqueKey(tag);
|
||||
};
|
||||
PDFPageLeaf.prototype.newExtGState = function (tag, extGStateRef) {
|
||||
var key = this.newExtGStateKey(tag);
|
||||
this.setExtGState(key, extGStateRef);
|
||||
return key;
|
||||
};
|
||||
PDFPageLeaf.prototype.ascend = function (visitor) {
|
||||
visitor(this);
|
||||
var Parent = this.Parent();
|
||||
if (Parent)
|
||||
Parent.ascend(visitor);
|
||||
};
|
||||
PDFPageLeaf.prototype.normalize = function () {
|
||||
if (this.normalized)
|
||||
return;
|
||||
var context = this.context;
|
||||
var contentsRef = this.get(PDFName.Contents);
|
||||
var contents = this.context.lookup(contentsRef);
|
||||
if (contents instanceof PDFStream) {
|
||||
this.set(PDFName.Contents, context.obj([contentsRef]));
|
||||
}
|
||||
if (this.autoNormalizeCTM) {
|
||||
this.wrapContentStreams(this.context.getPushGraphicsStateContentStream(), this.context.getPopGraphicsStateContentStream());
|
||||
}
|
||||
// TODO: Clone `Resources` if it is inherited
|
||||
var dictOrRef = this.getInheritableAttribute(PDFName.Resources);
|
||||
var Resources = context.lookupMaybe(dictOrRef, PDFDict) || context.obj({});
|
||||
this.set(PDFName.Resources, Resources);
|
||||
// TODO: Clone `Font` if it is inherited
|
||||
var Font = Resources.lookupMaybe(PDFName.Font, PDFDict) || context.obj({});
|
||||
Resources.set(PDFName.Font, Font);
|
||||
// TODO: Clone `XObject` if it is inherited
|
||||
var XObject = Resources.lookupMaybe(PDFName.XObject, PDFDict) || context.obj({});
|
||||
Resources.set(PDFName.XObject, XObject);
|
||||
// TODO: Clone `ExtGState` if it is inherited
|
||||
var ExtGState = Resources.lookupMaybe(PDFName.ExtGState, PDFDict) || context.obj({});
|
||||
Resources.set(PDFName.ExtGState, ExtGState);
|
||||
var Annots = this.Annots() || context.obj([]);
|
||||
this.set(PDFName.Annots, Annots);
|
||||
this.normalized = true;
|
||||
};
|
||||
PDFPageLeaf.prototype.normalizedEntries = function () {
|
||||
this.normalize();
|
||||
var Annots = this.Annots();
|
||||
var Resources = this.Resources();
|
||||
var Contents = this.Contents();
|
||||
return {
|
||||
Annots: Annots,
|
||||
Resources: Resources,
|
||||
Contents: Contents,
|
||||
Font: Resources.lookup(PDFName.Font, PDFDict),
|
||||
XObject: Resources.lookup(PDFName.XObject, PDFDict),
|
||||
ExtGState: Resources.lookup(PDFName.ExtGState, PDFDict),
|
||||
};
|
||||
};
|
||||
PDFPageLeaf.InheritableEntries = [
|
||||
'Resources',
|
||||
'MediaBox',
|
||||
'CropBox',
|
||||
'Rotate',
|
||||
];
|
||||
PDFPageLeaf.withContextAndParent = function (context, parent) {
|
||||
var dict = new Map();
|
||||
dict.set(PDFName.Type, PDFName.Page);
|
||||
dict.set(PDFName.Parent, parent);
|
||||
dict.set(PDFName.Resources, context.obj({}));
|
||||
dict.set(PDFName.MediaBox, context.obj([0, 0, 612, 792]));
|
||||
return new PDFPageLeaf(dict, context, false);
|
||||
};
|
||||
PDFPageLeaf.fromMapWithContext = function (map, context, autoNormalizeCTM) {
|
||||
if (autoNormalizeCTM === void 0) { autoNormalizeCTM = true; }
|
||||
return new PDFPageLeaf(map, context, autoNormalizeCTM);
|
||||
};
|
||||
return PDFPageLeaf;
|
||||
}(PDFDict));
|
||||
export default PDFPageLeaf;
|
||||
//# sourceMappingURL=PDFPageLeaf.js.map
|
||||
1
node_modules/pdf-lib/es/core/structures/PDFPageLeaf.js.map
generated
vendored
Normal file
1
node_modules/pdf-lib/es/core/structures/PDFPageLeaf.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
42
node_modules/pdf-lib/es/core/structures/PDFPageTree.d.ts
generated
vendored
Normal file
42
node_modules/pdf-lib/es/core/structures/PDFPageTree.d.ts
generated
vendored
Normal 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
|
||||
1
node_modules/pdf-lib/es/core/structures/PDFPageTree.d.ts.map
generated
vendored
Normal file
1
node_modules/pdf-lib/es/core/structures/PDFPageTree.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PDFPageTree.d.ts","sourceRoot":"","sources":["../../../src/core/structures/PDFPageTree.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,4BAAkC;AACjD,OAAO,OAAO,EAAE,EAAE,OAAO,EAAE,2BAAiC;AAE5D,OAAO,SAAS,6BAAmC;AACnD,OAAO,MAAM,0BAAgC;AAC7C,OAAO,UAAU,sBAA4B;AAC7C,OAAO,WAAW,sBAAwC;AAG1D,oBAAY,QAAQ,GAAG,WAAW,GAAG,WAAW,CAAC;AAEjD,cAAM,WAAY,SAAQ,OAAO;IAC/B,MAAM,CAAC,WAAW,YAAa,UAAU,8CAOvC;IAEF,MAAM,CAAC,kBAAkB,0BAA2B,UAAU,iBAC9B;IAEhC,MAAM,IAAI,WAAW,GAAG,SAAS;IAIjC,IAAI,IAAI,QAAQ;IAIhB,KAAK,IAAI,SAAS;IAIlB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAKnC,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAKnC;;;;;;;;OAQG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IA+CxE;;;;;;;OAOG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,UAAO,GAAG,IAAI;IAyCvD,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,GAAG,GAAG,IAAI;IAMjD,wDAAwD;IACxD,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,KAAK,GAAG,GAAG,IAAI;IAU7D,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,SAAS;CAalB;AAED,eAAe,WAAW,CAAC"}
|
||||
175
node_modules/pdf-lib/es/core/structures/PDFPageTree.js
generated
vendored
Normal file
175
node_modules/pdf-lib/es/core/structures/PDFPageTree.js
generated
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
import { __extends } from "tslib";
|
||||
import PDFArray from "../objects/PDFArray";
|
||||
import PDFDict from "../objects/PDFDict";
|
||||
import PDFName from "../objects/PDFName";
|
||||
import PDFNumber from "../objects/PDFNumber";
|
||||
import PDFPageLeaf from "./PDFPageLeaf";
|
||||
import { InvalidTargetIndexError, CorruptPageTreeError } from "../errors";
|
||||
var PDFPageTree = /** @class */ (function (_super) {
|
||||
__extends(PDFPageTree, _super);
|
||||
function PDFPageTree() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
PDFPageTree.prototype.Parent = function () {
|
||||
return this.lookup(PDFName.of('Parent'));
|
||||
};
|
||||
PDFPageTree.prototype.Kids = function () {
|
||||
return this.lookup(PDFName.of('Kids'), PDFArray);
|
||||
};
|
||||
PDFPageTree.prototype.Count = function () {
|
||||
return this.lookup(PDFName.of('Count'), PDFNumber);
|
||||
};
|
||||
PDFPageTree.prototype.pushTreeNode = function (treeRef) {
|
||||
var Kids = this.Kids();
|
||||
Kids.push(treeRef);
|
||||
};
|
||||
PDFPageTree.prototype.pushLeafNode = function (leafRef) {
|
||||
var Kids = this.Kids();
|
||||
this.insertLeafKid(Kids.size(), leafRef);
|
||||
};
|
||||
/**
|
||||
* 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).
|
||||
*/
|
||||
PDFPageTree.prototype.insertLeafNode = function (leafRef, targetIndex) {
|
||||
var Kids = this.Kids();
|
||||
var Count = this.Count().asNumber();
|
||||
if (targetIndex > Count) {
|
||||
throw new InvalidTargetIndexError(targetIndex, Count);
|
||||
}
|
||||
var leafsRemainingUntilTarget = targetIndex;
|
||||
for (var idx = 0, len = Kids.size(); idx < len; idx++) {
|
||||
if (leafsRemainingUntilTarget === 0) {
|
||||
// Insert page and return
|
||||
this.insertLeafKid(idx, leafRef);
|
||||
return undefined;
|
||||
}
|
||||
var kidRef = Kids.get(idx);
|
||||
var kid = this.context.lookup(kidRef);
|
||||
if (kid instanceof PDFPageTree) {
|
||||
if (kid.Count().asNumber() > leafsRemainingUntilTarget) {
|
||||
// Dig in
|
||||
return (kid.insertLeafNode(leafRef, leafsRemainingUntilTarget) || kidRef);
|
||||
}
|
||||
else {
|
||||
// Move on
|
||||
leafsRemainingUntilTarget -= kid.Count().asNumber();
|
||||
}
|
||||
}
|
||||
if (kid instanceof PDFPageLeaf) {
|
||||
// Move on
|
||||
leafsRemainingUntilTarget -= 1;
|
||||
}
|
||||
}
|
||||
if (leafsRemainingUntilTarget === 0) {
|
||||
// Insert page at the end and return
|
||||
this.insertLeafKid(Kids.size(), leafRef);
|
||||
return undefined;
|
||||
}
|
||||
// Should never get here if `targetIndex` is valid
|
||||
throw new CorruptPageTreeError(targetIndex, 'insertLeafNode');
|
||||
};
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
PDFPageTree.prototype.removeLeafNode = function (targetIndex, prune) {
|
||||
if (prune === void 0) { prune = true; }
|
||||
var Kids = this.Kids();
|
||||
var Count = this.Count().asNumber();
|
||||
if (targetIndex >= Count) {
|
||||
throw new InvalidTargetIndexError(targetIndex, Count);
|
||||
}
|
||||
var leafsRemainingUntilTarget = targetIndex;
|
||||
for (var idx = 0, len = Kids.size(); idx < len; idx++) {
|
||||
var kidRef = Kids.get(idx);
|
||||
var kid = this.context.lookup(kidRef);
|
||||
if (kid instanceof PDFPageTree) {
|
||||
if (kid.Count().asNumber() > leafsRemainingUntilTarget) {
|
||||
// Dig in
|
||||
kid.removeLeafNode(leafsRemainingUntilTarget, prune);
|
||||
if (prune && kid.Kids().size() === 0)
|
||||
Kids.remove(idx);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// Move on
|
||||
leafsRemainingUntilTarget -= kid.Count().asNumber();
|
||||
}
|
||||
}
|
||||
if (kid instanceof PDFPageLeaf) {
|
||||
if (leafsRemainingUntilTarget === 0) {
|
||||
// Remove page and return
|
||||
this.removeKid(idx);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// Move on
|
||||
leafsRemainingUntilTarget -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Should never get here if `targetIndex` is valid
|
||||
throw new CorruptPageTreeError(targetIndex, 'removeLeafNode');
|
||||
};
|
||||
PDFPageTree.prototype.ascend = function (visitor) {
|
||||
visitor(this);
|
||||
var Parent = this.Parent();
|
||||
if (Parent)
|
||||
Parent.ascend(visitor);
|
||||
};
|
||||
/** Performs a Post-Order traversal of this page tree */
|
||||
PDFPageTree.prototype.traverse = function (visitor) {
|
||||
var Kids = this.Kids();
|
||||
for (var idx = 0, len = Kids.size(); idx < len; idx++) {
|
||||
var kidRef = Kids.get(idx);
|
||||
var kid = this.context.lookup(kidRef);
|
||||
if (kid instanceof PDFPageTree)
|
||||
kid.traverse(visitor);
|
||||
visitor(kid, kidRef);
|
||||
}
|
||||
};
|
||||
PDFPageTree.prototype.insertLeafKid = function (kidIdx, leafRef) {
|
||||
var Kids = this.Kids();
|
||||
this.ascend(function (node) {
|
||||
var newCount = node.Count().asNumber() + 1;
|
||||
node.set(PDFName.of('Count'), PDFNumber.of(newCount));
|
||||
});
|
||||
Kids.insert(kidIdx, leafRef);
|
||||
};
|
||||
PDFPageTree.prototype.removeKid = function (kidIdx) {
|
||||
var Kids = this.Kids();
|
||||
var kid = Kids.lookup(kidIdx);
|
||||
if (kid instanceof PDFPageLeaf) {
|
||||
this.ascend(function (node) {
|
||||
var newCount = node.Count().asNumber() - 1;
|
||||
node.set(PDFName.of('Count'), PDFNumber.of(newCount));
|
||||
});
|
||||
}
|
||||
Kids.remove(kidIdx);
|
||||
};
|
||||
PDFPageTree.withContext = function (context, parent) {
|
||||
var dict = new Map();
|
||||
dict.set(PDFName.of('Type'), PDFName.of('Pages'));
|
||||
dict.set(PDFName.of('Kids'), context.obj([]));
|
||||
dict.set(PDFName.of('Count'), context.obj(0));
|
||||
if (parent)
|
||||
dict.set(PDFName.of('Parent'), parent);
|
||||
return new PDFPageTree(dict, context);
|
||||
};
|
||||
PDFPageTree.fromMapWithContext = function (map, context) {
|
||||
return new PDFPageTree(map, context);
|
||||
};
|
||||
return PDFPageTree;
|
||||
}(PDFDict));
|
||||
export default PDFPageTree;
|
||||
//# sourceMappingURL=PDFPageTree.js.map
|
||||
1
node_modules/pdf-lib/es/core/structures/PDFPageTree.js.map
generated
vendored
Normal file
1
node_modules/pdf-lib/es/core/structures/PDFPageTree.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user