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

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 @@
{"version":3,"file":"AppearanceCharacteristics.d.ts","sourceRoot":"","sources":["../../../src/core/annotation/AppearanceCharacteristics.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,2BAAiC;AAE/C,OAAO,SAAS,6BAAmC;AACnD,OAAO,QAAQ,4BAAkC;AACjD,OAAO,YAAY,gCAAsC;AACzD,OAAO,SAAS,6BAAmC;AAEnD,cAAM,yBAAyB;IAC7B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAEvB,MAAM,CAAC,QAAQ,SAAU,OAAO,KAAG,yBAAyB,CACtB;IAEtC,SAAS,aAAa,IAAI,EAAE,OAAO;IAInC,CAAC,IAAI,SAAS,GAAG,SAAS;IAM1B,EAAE,IAAI,QAAQ,GAAG,SAAS;IAM1B,EAAE,IAAI,QAAQ,GAAG,SAAS;IAM1B,EAAE,IAAI,YAAY,GAAG,SAAS,GAAG,SAAS;IAM1C,EAAE,IAAI,YAAY,GAAG,SAAS,GAAG,SAAS;IAM1C,EAAE,IAAI,YAAY,GAAG,SAAS,GAAG,SAAS;IAM1C,WAAW,IAAI,MAAM,GAAG,SAAS;IAIjC,cAAc,IAAI,MAAM,EAAE,GAAG,SAAS;IActC,kBAAkB,IAAI,MAAM,EAAE,GAAG,SAAS;IAc1C,WAAW,IAAI;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;IAYpE,WAAW,CAAC,QAAQ,EAAE,MAAM;IAK5B,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE;IAK9B,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE;IAKlC,WAAW,CAAC,QAAQ,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE;CAkB3E;AAED,eAAe,yBAAyB,CAAC"}

View File

@@ -0,0 +1,123 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName"));
var PDFNumber_1 = tslib_1.__importDefault(require("../objects/PDFNumber"));
var PDFArray_1 = tslib_1.__importDefault(require("../objects/PDFArray"));
var PDFHexString_1 = tslib_1.__importDefault(require("../objects/PDFHexString"));
var PDFString_1 = tslib_1.__importDefault(require("../objects/PDFString"));
var AppearanceCharacteristics = /** @class */ (function () {
function AppearanceCharacteristics(dict) {
this.dict = dict;
}
AppearanceCharacteristics.prototype.R = function () {
var R = this.dict.lookup(PDFName_1.default.of('R'));
if (R instanceof PDFNumber_1.default)
return R;
return undefined;
};
AppearanceCharacteristics.prototype.BC = function () {
var BC = this.dict.lookup(PDFName_1.default.of('BC'));
if (BC instanceof PDFArray_1.default)
return BC;
return undefined;
};
AppearanceCharacteristics.prototype.BG = function () {
var BG = this.dict.lookup(PDFName_1.default.of('BG'));
if (BG instanceof PDFArray_1.default)
return BG;
return undefined;
};
AppearanceCharacteristics.prototype.CA = function () {
var CA = this.dict.lookup(PDFName_1.default.of('CA'));
if (CA instanceof PDFHexString_1.default || CA instanceof PDFString_1.default)
return CA;
return undefined;
};
AppearanceCharacteristics.prototype.RC = function () {
var RC = this.dict.lookup(PDFName_1.default.of('RC'));
if (RC instanceof PDFHexString_1.default || RC instanceof PDFString_1.default)
return RC;
return undefined;
};
AppearanceCharacteristics.prototype.AC = function () {
var AC = this.dict.lookup(PDFName_1.default.of('AC'));
if (AC instanceof PDFHexString_1.default || AC instanceof PDFString_1.default)
return AC;
return undefined;
};
AppearanceCharacteristics.prototype.getRotation = function () {
var _a;
return (_a = this.R()) === null || _a === void 0 ? void 0 : _a.asNumber();
};
AppearanceCharacteristics.prototype.getBorderColor = function () {
var BC = this.BC();
if (!BC)
return undefined;
var components = [];
for (var idx = 0, len = BC === null || BC === void 0 ? void 0 : BC.size(); idx < len; idx++) {
var component = BC.get(idx);
if (component instanceof PDFNumber_1.default)
components.push(component.asNumber());
}
return components;
};
AppearanceCharacteristics.prototype.getBackgroundColor = function () {
var BG = this.BG();
if (!BG)
return undefined;
var components = [];
for (var idx = 0, len = BG === null || BG === void 0 ? void 0 : BG.size(); idx < len; idx++) {
var component = BG.get(idx);
if (component instanceof PDFNumber_1.default)
components.push(component.asNumber());
}
return components;
};
AppearanceCharacteristics.prototype.getCaptions = function () {
var CA = this.CA();
var RC = this.RC();
var AC = this.AC();
return {
normal: CA === null || CA === void 0 ? void 0 : CA.decodeText(),
rollover: RC === null || RC === void 0 ? void 0 : RC.decodeText(),
down: AC === null || AC === void 0 ? void 0 : AC.decodeText(),
};
};
AppearanceCharacteristics.prototype.setRotation = function (rotation) {
var R = this.dict.context.obj(rotation);
this.dict.set(PDFName_1.default.of('R'), R);
};
AppearanceCharacteristics.prototype.setBorderColor = function (color) {
var BC = this.dict.context.obj(color);
this.dict.set(PDFName_1.default.of('BC'), BC);
};
AppearanceCharacteristics.prototype.setBackgroundColor = function (color) {
var BG = this.dict.context.obj(color);
this.dict.set(PDFName_1.default.of('BG'), BG);
};
AppearanceCharacteristics.prototype.setCaptions = function (captions) {
var CA = PDFHexString_1.default.fromText(captions.normal);
this.dict.set(PDFName_1.default.of('CA'), CA);
if (captions.rollover) {
var RC = PDFHexString_1.default.fromText(captions.rollover);
this.dict.set(PDFName_1.default.of('RC'), RC);
}
else {
this.dict.delete(PDFName_1.default.of('RC'));
}
if (captions.down) {
var AC = PDFHexString_1.default.fromText(captions.down);
this.dict.set(PDFName_1.default.of('AC'), AC);
}
else {
this.dict.delete(PDFName_1.default.of('AC'));
}
};
AppearanceCharacteristics.fromDict = function (dict) {
return new AppearanceCharacteristics(dict);
};
return AppearanceCharacteristics;
}());
exports.default = AppearanceCharacteristics;
//# sourceMappingURL=AppearanceCharacteristics.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AppearanceCharacteristics.js","sourceRoot":"","sources":["../../../src/core/annotation/AppearanceCharacteristics.ts"],"names":[],"mappings":";;;AACA,uEAA+C;AAC/C,2EAAmD;AACnD,yEAAiD;AACjD,iFAAyD;AACzD,2EAAmD;AAEnD;IAME,mCAAsB,IAAa;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,qCAAC,GAAD;QACE,IAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5C,IAAI,CAAC,YAAY,mBAAS;YAAE,OAAO,CAAC,CAAC;QACrC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,sCAAE,GAAF;QACE,IAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9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,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;SACrC;aAAM;YACL,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;SACpC;QAED,IAAI,QAAQ,CAAC,IAAI,EAAE;YACjB,IAAM,EAAE,GAAG,sBAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAChD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;SACrC;aAAM;YACL,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;SACpC;IACH,CAAC;IAvHM,kCAAQ,GAAG,UAAC,IAAa;QAC9B,OAAA,IAAI,yBAAyB,CAAC,IAAI,CAAC;IAAnC,CAAmC,CAAC;IAuHxC,gCAAC;CAAA,AA3HD,IA2HC;AAED,kBAAe,yBAAyB,CAAC"}

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 @@
{"version":3,"file":"BorderStyle.d.ts","sourceRoot":"","sources":["../../../src/core/annotation/BorderStyle.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,2BAAiC;AAE/C,OAAO,SAAS,6BAAmC;AAGnD,cAAM,WAAW;IACf,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAEvB,MAAM,CAAC,QAAQ,SAAU,OAAO,KAAG,WAAW,CAA0B;IAExE,SAAS,aAAa,IAAI,EAAE,OAAO;IAInC,CAAC,IAAI,SAAS,GAAG,SAAS;IAM1B,QAAQ,IAAI,MAAM,GAAG,SAAS;IAI9B,QAAQ,CAAC,KAAK,EAAE,MAAM;CAIvB;AAED,eAAe,WAAW,CAAC"}

View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName"));
var PDFNumber_1 = tslib_1.__importDefault(require("../objects/PDFNumber"));
// TODO: Also handle the `/S` and `/D` entries
var BorderStyle = /** @class */ (function () {
function BorderStyle(dict) {
this.dict = dict;
}
BorderStyle.prototype.W = function () {
var W = this.dict.lookup(PDFName_1.default.of('W'));
if (W instanceof PDFNumber_1.default)
return W;
return undefined;
};
BorderStyle.prototype.getWidth = function () {
var _a, _b;
return (_b = (_a = this.W()) === null || _a === void 0 ? void 0 : _a.asNumber()) !== null && _b !== void 0 ? _b : 1;
};
BorderStyle.prototype.setWidth = function (width) {
var W = this.dict.context.obj(width);
this.dict.set(PDFName_1.default.of('W'), W);
};
BorderStyle.fromDict = function (dict) { return new BorderStyle(dict); };
return BorderStyle;
}());
exports.default = BorderStyle;
//# sourceMappingURL=BorderStyle.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BorderStyle.js","sourceRoot":"","sources":["../../../src/core/annotation/BorderStyle.ts"],"names":[],"mappings":";;;AACA,uEAA+C;AAC/C,2EAAmD;AAEnD,8CAA8C;AAC9C;IAKE,qBAAsB,IAAa;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,uBAAC,GAAD;QACE,IAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5C,IAAI,CAAC,YAAY,mBAAS;YAAE,OAAO,CAAC,CAAC;QACrC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,8BAAQ,GAAR;;QACE,mBAAO,IAAI,CAAC,CAAC,EAAE,0CAAE,QAAQ,qCAAM,CAAC,CAAC;IACnC,CAAC;IAED,8BAAQ,GAAR,UAAS,KAAa;QACpB,IAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAO,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC;IAnBM,oBAAQ,GAAG,UAAC,IAAa,IAAkB,OAAA,IAAI,WAAW,CAAC,IAAI,CAAC,EAArB,CAAqB,CAAC;IAoB1E,kBAAC;CAAA,AAvBD,IAuBC;AAED,kBAAe,WAAW,CAAC"}

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 @@
{"version":3,"file":"PDFAnnotation.d.ts","sourceRoot":"","sources":["../../../src/core/annotation/PDFAnnotation.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,2BAAiC;AAC/C,OAAO,OAAO,2BAAiC;AAC/C,OAAO,SAAS,6BAAmC;AACnD,OAAO,QAAQ,4BAAkC;AACjD,OAAO,MAAM,0BAAgC;AAC7C,OAAO,SAAS,6BAAmC;AAEnD,cAAM,aAAa;IACjB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAEvB,MAAM,CAAC,QAAQ,SAAU,OAAO,KAAG,aAAa,CAA4B;IAE5E,SAAS,aAAa,IAAI,EAAE,OAAO;IAKnC,IAAI,IAAI,QAAQ,GAAG,SAAS;IAI5B,EAAE,IAAI,OAAO,GAAG,SAAS;IAIzB,CAAC,IAAI,SAAS,GAAG,SAAS;IAK1B,YAAY,IAAI;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAKvE,YAAY,CAAC,IAAI,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAM1E,kBAAkB,IAAI,OAAO,GAAG,SAAS;IAMzC,kBAAkB,CAAC,KAAK,EAAE,OAAO;IAIjC,cAAc,CAAC,WAAW,EAAE,OAAO;IAInC,QAAQ,IAAI,OAAO;IASnB,mBAAmB,IAAI,MAAM,GAAG,OAAO;IAQvC,+DAA+D;IAC/D,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAKhD,+DAA+D;IAC/D,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAKlD,+DAA+D;IAC/D,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAK9C,wBAAwB;IAKxB,oBAAoB;IAKpB,cAAc,IACV;QACE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;QAC5B,QAAQ,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;QAC/B,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;KAC5B,GACD,SAAS;IAYb,QAAQ,IAAI,MAAM;IAIlB,QAAQ,CAAC,KAAK,EAAE,MAAM;IAItB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAK9B,OAAO,CAAC,IAAI,EAAE,MAAM;IAKpB,SAAS,CAAC,IAAI,EAAE,MAAM;IAKtB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO;CAIxC;AAED,eAAe,aAAa,CAAC"}

View File

@@ -0,0 +1,123 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var PDFDict_1 = tslib_1.__importDefault(require("../objects/PDFDict"));
var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName"));
var PDFStream_1 = tslib_1.__importDefault(require("../objects/PDFStream"));
var PDFArray_1 = tslib_1.__importDefault(require("../objects/PDFArray"));
var PDFRef_1 = tslib_1.__importDefault(require("../objects/PDFRef"));
var PDFNumber_1 = tslib_1.__importDefault(require("../objects/PDFNumber"));
var PDFAnnotation = /** @class */ (function () {
function PDFAnnotation(dict) {
this.dict = dict;
}
// This is technically required by the PDF spec
PDFAnnotation.prototype.Rect = function () {
return this.dict.lookup(PDFName_1.default.of('Rect'), PDFArray_1.default);
};
PDFAnnotation.prototype.AP = function () {
return this.dict.lookupMaybe(PDFName_1.default.of('AP'), PDFDict_1.default);
};
PDFAnnotation.prototype.F = function () {
var numberOrRef = this.dict.lookup(PDFName_1.default.of('F'));
return this.dict.context.lookupMaybe(numberOrRef, PDFNumber_1.default);
};
PDFAnnotation.prototype.getRectangle = function () {
var _a;
var Rect = this.Rect();
return (_a = Rect === null || Rect === void 0 ? void 0 : Rect.asRectangle()) !== null && _a !== void 0 ? _a : { x: 0, y: 0, width: 0, height: 0 };
};
PDFAnnotation.prototype.setRectangle = function (rect) {
var x = rect.x, y = rect.y, width = rect.width, height = rect.height;
var Rect = this.dict.context.obj([x, y, x + width, y + height]);
this.dict.set(PDFName_1.default.of('Rect'), Rect);
};
PDFAnnotation.prototype.getAppearanceState = function () {
var AS = this.dict.lookup(PDFName_1.default.of('AS'));
if (AS instanceof PDFName_1.default)
return AS;
return undefined;
};
PDFAnnotation.prototype.setAppearanceState = function (state) {
this.dict.set(PDFName_1.default.of('AS'), state);
};
PDFAnnotation.prototype.setAppearances = function (appearances) {
this.dict.set(PDFName_1.default.of('AP'), appearances);
};
PDFAnnotation.prototype.ensureAP = function () {
var AP = this.AP();
if (!AP) {
AP = this.dict.context.obj({});
this.dict.set(PDFName_1.default.of('AP'), AP);
}
return AP;
};
PDFAnnotation.prototype.getNormalAppearance = function () {
var AP = this.ensureAP();
var N = AP.get(PDFName_1.default.of('N'));
if (N instanceof PDFRef_1.default || N instanceof PDFDict_1.default)
return N;
throw new Error("Unexpected N type: " + (N === null || N === void 0 ? void 0 : N.constructor.name));
};
/** @param appearance A PDFDict or PDFStream (direct or ref) */
PDFAnnotation.prototype.setNormalAppearance = function (appearance) {
var AP = this.ensureAP();
AP.set(PDFName_1.default.of('N'), appearance);
};
/** @param appearance A PDFDict or PDFStream (direct or ref) */
PDFAnnotation.prototype.setRolloverAppearance = function (appearance) {
var AP = this.ensureAP();
AP.set(PDFName_1.default.of('R'), appearance);
};
/** @param appearance A PDFDict or PDFStream (direct or ref) */
PDFAnnotation.prototype.setDownAppearance = function (appearance) {
var AP = this.ensureAP();
AP.set(PDFName_1.default.of('D'), appearance);
};
PDFAnnotation.prototype.removeRolloverAppearance = function () {
var AP = this.AP();
AP === null || AP === void 0 ? void 0 : AP.delete(PDFName_1.default.of('R'));
};
PDFAnnotation.prototype.removeDownAppearance = function () {
var AP = this.AP();
AP === null || AP === void 0 ? void 0 : AP.delete(PDFName_1.default.of('D'));
};
PDFAnnotation.prototype.getAppearances = function () {
var AP = this.AP();
if (!AP)
return undefined;
var N = AP.lookup(PDFName_1.default.of('N'), PDFDict_1.default, PDFStream_1.default);
var R = AP.lookupMaybe(PDFName_1.default.of('R'), PDFDict_1.default, PDFStream_1.default);
var D = AP.lookupMaybe(PDFName_1.default.of('D'), PDFDict_1.default, PDFStream_1.default);
return { normal: N, rollover: R, down: D };
};
PDFAnnotation.prototype.getFlags = function () {
var _a, _b;
return (_b = (_a = this.F()) === null || _a === void 0 ? void 0 : _a.asNumber()) !== null && _b !== void 0 ? _b : 0;
};
PDFAnnotation.prototype.setFlags = function (flags) {
this.dict.set(PDFName_1.default.of('F'), PDFNumber_1.default.of(flags));
};
PDFAnnotation.prototype.hasFlag = function (flag) {
var flags = this.getFlags();
return (flags & flag) !== 0;
};
PDFAnnotation.prototype.setFlag = function (flag) {
var flags = this.getFlags();
this.setFlags(flags | flag);
};
PDFAnnotation.prototype.clearFlag = function (flag) {
var flags = this.getFlags();
this.setFlags(flags & ~flag);
};
PDFAnnotation.prototype.setFlagTo = function (flag, enable) {
if (enable)
this.setFlag(flag);
else
this.clearFlag(flag);
};
PDFAnnotation.fromDict = function (dict) { return new PDFAnnotation(dict); };
return PDFAnnotation;
}());
exports.default = PDFAnnotation;
//# sourceMappingURL=PDFAnnotation.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"PDFAnnotation.js","sourceRoot":"","sources":["../../../src/core/annotation/PDFAnnotation.ts"],"names":[],"mappings":";;;AAAA,uEAA+C;AAC/C,uEAA+C;AAC/C,2EAAmD;AACnD,yEAAiD;AACjD,qEAA6C;AAC7C,2EAAmD;AAEnD;IA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AAS,GAAT,UAAU,IAAY,EAAE,MAAe;QACrC,IAAI,MAAM;YAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;;YAC1B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAtIM,sBAAQ,GAAG,UAAC,IAAa,IAAoB,OAAA,IAAI,aAAa,CAAC,IAAI,CAAC,EAAvB,CAAuB,CAAC;IAuI9E,oBAAC;CAAA,AA1ID,IA0IC;AAED,kBAAe,aAAa,CAAC"}

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 @@
{"version":3,"file":"PDFWidgetAnnotation.d.ts","sourceRoot":"","sources":["../../../src/core/annotation/PDFWidgetAnnotation.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,2BAAiC;AAC/C,OAAO,OAAO,2BAAiC;AAC/C,OAAO,MAAM,0BAAgC;AAC7C,OAAO,SAAS,6BAAmC;AACnD,OAAO,YAAY,gCAAsC;AACzD,OAAO,UAAU,sBAA4B;AAC7C,OAAO,WAAW,sBAAwC;AAC1D,OAAO,aAAa,wBAA0C;AAC9D,OAAO,yBAAyB,oCAAsD;AAEtF,cAAM,mBAAoB,SAAQ,aAAa;IAC7C,MAAM,CAAC,QAAQ,SAAU,OAAO,KAAG,mBAAmB,CACtB;IAEhC,MAAM,CAAC,MAAM,YAAa,UAAU,UAAU,MAAM,yBAQlD;IAEF,EAAE,IAAI,OAAO,GAAG,SAAS;IAMzB,EAAE,IAAI,OAAO,GAAG,SAAS;IAMzB,EAAE,IAAI,SAAS,GAAG,YAAY,GAAG,SAAS;IAM1C,CAAC,IAAI,MAAM,GAAG,SAAS;IAMvB,IAAI,CAAC,IAAI,EAAE,MAAM;IAIjB,oBAAoB,CAAC,UAAU,EAAE,MAAM;IAIvC,oBAAoB,IAAI,MAAM,GAAG,SAAS;IAU1C,4BAA4B,IAAI,yBAAyB,GAAG,SAAS;IAMrE,oCAAoC,IAAI,yBAAyB;IASjE,cAAc,IAAI,WAAW,GAAG,SAAS;IAMzC,sBAAsB,IAAI,WAAW;IASrC,UAAU,IAAI,OAAO,GAAG,SAAS;CAalC;AAED,eAAe,mBAAmB,CAAC"}

View File

@@ -0,0 +1,110 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var PDFDict_1 = tslib_1.__importDefault(require("../objects/PDFDict"));
var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName"));
var PDFRef_1 = tslib_1.__importDefault(require("../objects/PDFRef"));
var PDFString_1 = tslib_1.__importDefault(require("../objects/PDFString"));
var PDFHexString_1 = tslib_1.__importDefault(require("../objects/PDFHexString"));
var BorderStyle_1 = tslib_1.__importDefault(require("./BorderStyle"));
var PDFAnnotation_1 = tslib_1.__importDefault(require("./PDFAnnotation"));
var AppearanceCharacteristics_1 = tslib_1.__importDefault(require("./AppearanceCharacteristics"));
var PDFWidgetAnnotation = /** @class */ (function (_super) {
tslib_1.__extends(PDFWidgetAnnotation, _super);
function PDFWidgetAnnotation() {
return _super !== null && _super.apply(this, arguments) || this;
}
PDFWidgetAnnotation.prototype.MK = function () {
var MK = this.dict.lookup(PDFName_1.default.of('MK'));
if (MK instanceof PDFDict_1.default)
return MK;
return undefined;
};
PDFWidgetAnnotation.prototype.BS = function () {
var BS = this.dict.lookup(PDFName_1.default.of('BS'));
if (BS instanceof PDFDict_1.default)
return BS;
return undefined;
};
PDFWidgetAnnotation.prototype.DA = function () {
var da = this.dict.lookup(PDFName_1.default.of('DA'));
if (da instanceof PDFString_1.default || da instanceof PDFHexString_1.default)
return da;
return undefined;
};
PDFWidgetAnnotation.prototype.P = function () {
var P = this.dict.get(PDFName_1.default.of('P'));
if (P instanceof PDFRef_1.default)
return P;
return undefined;
};
PDFWidgetAnnotation.prototype.setP = function (page) {
this.dict.set(PDFName_1.default.of('P'), page);
};
PDFWidgetAnnotation.prototype.setDefaultAppearance = function (appearance) {
this.dict.set(PDFName_1.default.of('DA'), PDFString_1.default.of(appearance));
};
PDFWidgetAnnotation.prototype.getDefaultAppearance = function () {
var DA = this.DA();
if (DA instanceof PDFHexString_1.default) {
return DA.decodeText();
}
return DA === null || DA === void 0 ? void 0 : DA.asString();
};
PDFWidgetAnnotation.prototype.getAppearanceCharacteristics = function () {
var MK = this.MK();
if (MK)
return AppearanceCharacteristics_1.default.fromDict(MK);
return undefined;
};
PDFWidgetAnnotation.prototype.getOrCreateAppearanceCharacteristics = function () {
var MK = this.MK();
if (MK)
return AppearanceCharacteristics_1.default.fromDict(MK);
var ac = AppearanceCharacteristics_1.default.fromDict(this.dict.context.obj({}));
this.dict.set(PDFName_1.default.of('MK'), ac.dict);
return ac;
};
PDFWidgetAnnotation.prototype.getBorderStyle = function () {
var BS = this.BS();
if (BS)
return BorderStyle_1.default.fromDict(BS);
return undefined;
};
PDFWidgetAnnotation.prototype.getOrCreateBorderStyle = function () {
var BS = this.BS();
if (BS)
return BorderStyle_1.default.fromDict(BS);
var bs = BorderStyle_1.default.fromDict(this.dict.context.obj({}));
this.dict.set(PDFName_1.default.of('BS'), bs.dict);
return bs;
};
PDFWidgetAnnotation.prototype.getOnValue = function () {
var _a;
var normal = (_a = this.getAppearances()) === null || _a === void 0 ? void 0 : _a.normal;
if (normal instanceof PDFDict_1.default) {
var keys = normal.keys();
for (var idx = 0, len = keys.length; idx < len; idx++) {
var key = keys[idx];
if (key !== PDFName_1.default.of('Off'))
return key;
}
}
return undefined;
};
PDFWidgetAnnotation.fromDict = function (dict) {
return new PDFWidgetAnnotation(dict);
};
PDFWidgetAnnotation.create = function (context, parent) {
var dict = context.obj({
Type: 'Annot',
Subtype: 'Widget',
Rect: [0, 0, 0, 0],
Parent: parent,
});
return new PDFWidgetAnnotation(dict);
};
return PDFWidgetAnnotation;
}(PDFAnnotation_1.default));
exports.default = PDFWidgetAnnotation;
//# sourceMappingURL=PDFWidgetAnnotation.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"PDFWidgetAnnotation.js","sourceRoot":"","sources":["../../../src/core/annotation/PDFWidgetAnnotation.ts"],"names":[],"mappings":";;;AAAA,uEAA+C;AAC/C,uEAA+C;AAC/C,qEAA6C;AAC7C,2EAAmD;AACnD,iFAAyD;AAEzD,sEAA0D;AAC1D,0EAA8D;AAC9D,kGAAsF;AAEtF;IAAkC,+CAAa;IAA/C;;IAmGA,CAAC;IArFC,gCAAE,GAAF;QACE,IAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9C,IAAI,EAAE,YAAY,iBAAO;YAAE,OAAO,EAAE,CAAC;QACrC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,gCAAE,GAAF;QACE,IAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9C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I,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;YAC3B,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,EAAE;gBACrD,IAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;gBACtB,IAAI,GAAG,KAAK,iBAAO,CAAC,EAAE,CAAC,KAAK,CAAC;oBAAE,OAAO,GAAG,CAAC;aAC3C;SACF;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAjGM,4BAAQ,GAAG,UAAC,IAAa;QAC9B,OAAA,IAAI,mBAAmB,CAAC,IAAI,CAAC;IAA7B,CAA6B,CAAC;IAEzB,0BAAM,GAAG,UAAC,OAAmB,EAAE,MAAc;QAClD,IAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;YACvB,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,QAAQ;YACjB,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YAClB,MAAM,EAAE,MAAM;SACf,CAAC,CAAC;QACH,OAAO,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC,CAAC;IAuFJ,0BAAC;CAAA,AAnGD,CAAkC,uBAAa,GAmG9C;AAED,kBAAe,mBAAmB,CAAC"}

80
node_modules/pdf-lib/cjs/core/annotation/flags.d.ts generated vendored Normal file
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 @@
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../../src/core/annotation/flags.ts"],"names":[],"mappings":"AAEA,8BAA8B;AAC9B,oBAAY,eAAe;IACzB;;;;;OAKG;IACH,SAAuB;IAEvB;;;;;;;;;OASG;IACH,MAAoB;IAEpB;;;;;;OAMG;IACH,KAAmB;IAEnB;;;;;OAKG;IACH,MAAoB;IAEpB;;;;OAIG;IACH,QAAsB;IAEtB;;;;;OAKG;IACH,MAAoB;IAEpB;;;;;;;;OAQG;IACH,QAAsB;IAEtB;;;;;OAKG;IACH,MAAoB;IAEpB;;;;;OAKG;IACH,YAA0B;IAE1B;;;;OAIG;IACH,cAA6B;CAC9B"}

85
node_modules/pdf-lib/cjs/core/annotation/flags.js generated vendored Normal file
View File

@@ -0,0 +1,85 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AnnotationFlags = void 0;
var flag = function (bitIndex) { return 1 << bitIndex; };
/** From PDF spec table 165 */
var AnnotationFlags;
(function (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.
*/
AnnotationFlags[AnnotationFlags["Invisible"] = flag(1 - 1)] = "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.
*/
AnnotationFlags[AnnotationFlags["Hidden"] = flag(2 - 1)] = "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.
*/
AnnotationFlags[AnnotationFlags["Print"] = flag(3 - 1)] = "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.
*/
AnnotationFlags[AnnotationFlags["NoZoom"] = flag(4 - 1)] = "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.
*/
AnnotationFlags[AnnotationFlags["NoRotate"] = flag(5 - 1)] = "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.
*/
AnnotationFlags[AnnotationFlags["NoView"] = flag(6 - 1)] = "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.
*/
AnnotationFlags[AnnotationFlags["ReadOnly"] = flag(7 - 1)] = "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.
*/
AnnotationFlags[AnnotationFlags["Locked"] = flag(8 - 1)] = "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.
*/
AnnotationFlags[AnnotationFlags["ToggleNoView"] = flag(9 - 1)] = "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.
*/
AnnotationFlags[AnnotationFlags["LockedContents"] = flag(10 - 1)] = "LockedContents";
})(AnnotationFlags = exports.AnnotationFlags || (exports.AnnotationFlags = {}));
//# sourceMappingURL=flags.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../../../src/core/annotation/flags.ts"],"names":[],"mappings":";;;AAAA,IAAM,IAAI,GAAG,UAAC,QAAgB,IAAK,OAAA,CAAC,IAAI,QAAQ,EAAb,CAAa,CAAC;AAEjD,8BAA8B;AAC9B,IAAY,eAsFX;AAtFD,WAAY,eAAe;IACzB;;;;;OAKG;IACH,+CAAY,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,eAAA,CAAA;IAEvB;;;;;;;;;OASG;IACH,4CAAS,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,YAAA,CAAA;IAEpB;;;;;;OAMG;IACH,2CAAQ,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,WAAA,CAAA;IAEnB;;;;;OAKG;IACH,4CAAS,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,YAAA,CAAA;IAEpB;;;;OAIG;IACH,8CAAW,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,cAAA,CAAA;IAEtB;;;;;OAKG;IACH,4CAAS,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,YAAA,CAAA;IAEpB;;;;;;;;OAQG;IACH,8CAAW,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,cAAA,CAAA;IAEtB;;;;;OAKG;IACH,4CAAS,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,YAAA,CAAA;IAEpB;;;;;OAKG;IACH,kDAAe,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,kBAAA,CAAA;IAE1B;;;;OAIG;IACH,oDAAiB,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,oBAAA,CAAA;AAC/B,CAAC,EAtFW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAsF1B"}

5
node_modules/pdf-lib/cjs/core/annotation/index.d.ts generated vendored Normal file
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 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/annotation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAI2C,iBAAiB,CAJlB;AAC7E,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAGsD,uBAAuB,CAH7B;AACzF,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAEuE,6BAA6B,CAF9C;AACrG,cACmJ,SAAS,CADlH"}

11
node_modules/pdf-lib/cjs/core/annotation/index.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var PDFAnnotation_1 = require("./PDFAnnotation");
Object.defineProperty(exports, "PDFAnnotation", { enumerable: true, get: function () { return PDFAnnotation_1.default; } });
var PDFWidgetAnnotation_1 = require("./PDFWidgetAnnotation");
Object.defineProperty(exports, "PDFWidgetAnnotation", { enumerable: true, get: function () { return PDFWidgetAnnotation_1.default; } });
var AppearanceCharacteristics_1 = require("./AppearanceCharacteristics");
Object.defineProperty(exports, "AppearanceCharacteristics", { enumerable: true, get: function () { return AppearanceCharacteristics_1.default; } });
tslib_1.__exportStar(require("./flags"), exports);
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/annotation/index.ts"],"names":[],"mappings":";;;AAAA,iDAA6E;AAApE,8GAAA,OAAO,OAAiB;AACjC,6DAAyF;AAAhF,0HAAA,OAAO,OAAuB;AACvC,yEAAqG;AAA5F,sIAAA,OAAO,OAA6B;AAC7C,kDAA0C"}