@embedpdf/models 2.1.2 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -12
- package/dist/index.js.map +1 -1
- package/dist/pdf.d.ts +102 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1273,17 +1273,34 @@ function compareSearchTarget(targetA, targetB) {
|
|
|
1273
1273
|
const flagB = unionFlags(targetB.flags);
|
|
1274
1274
|
return flagA === flagB && targetA.keyword === targetB.keyword;
|
|
1275
1275
|
}
|
|
1276
|
-
var
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1276
|
+
var PdfPermissionFlag = /* @__PURE__ */ ((PdfPermissionFlag2) => {
|
|
1277
|
+
PdfPermissionFlag2[PdfPermissionFlag2["Print"] = 4] = "Print";
|
|
1278
|
+
PdfPermissionFlag2[PdfPermissionFlag2["ModifyContents"] = 8] = "ModifyContents";
|
|
1279
|
+
PdfPermissionFlag2[PdfPermissionFlag2["CopyContents"] = 16] = "CopyContents";
|
|
1280
|
+
PdfPermissionFlag2[PdfPermissionFlag2["ModifyAnnotations"] = 32] = "ModifyAnnotations";
|
|
1281
|
+
PdfPermissionFlag2[PdfPermissionFlag2["FillForms"] = 256] = "FillForms";
|
|
1282
|
+
PdfPermissionFlag2[PdfPermissionFlag2["ExtractForAccessibility"] = 512] = "ExtractForAccessibility";
|
|
1283
|
+
PdfPermissionFlag2[PdfPermissionFlag2["AssembleDocument"] = 1024] = "AssembleDocument";
|
|
1284
|
+
PdfPermissionFlag2[PdfPermissionFlag2["PrintHighQuality"] = 2048] = "PrintHighQuality";
|
|
1285
|
+
PdfPermissionFlag2[PdfPermissionFlag2["AllowAll"] = 3900] = "AllowAll";
|
|
1286
|
+
return PdfPermissionFlag2;
|
|
1287
|
+
})(PdfPermissionFlag || {});
|
|
1288
|
+
function buildPermissions(...flags) {
|
|
1289
|
+
let result = flags.reduce((acc, flag) => acc | flag, 0);
|
|
1290
|
+
if (result & 2048) {
|
|
1291
|
+
result |= 4;
|
|
1292
|
+
}
|
|
1293
|
+
return result;
|
|
1294
|
+
}
|
|
1295
|
+
class PermissionDeniedError extends Error {
|
|
1296
|
+
constructor(requiredFlags, currentPermissions) {
|
|
1297
|
+
const flagNames = requiredFlags.map((f) => PdfPermissionFlag[f]).join(", ");
|
|
1298
|
+
super(`Permission denied. Required: ${flagNames}`);
|
|
1299
|
+
this.requiredFlags = requiredFlags;
|
|
1300
|
+
this.currentPermissions = currentPermissions;
|
|
1301
|
+
this.name = "PermissionDeniedError";
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1287
1304
|
var PdfPageFlattenFlag = /* @__PURE__ */ ((PdfPageFlattenFlag2) => {
|
|
1288
1305
|
PdfPageFlattenFlag2[PdfPageFlattenFlag2["Display"] = 0] = "Display";
|
|
1289
1306
|
PdfPageFlattenFlag2[PdfPageFlattenFlag2["Print"] = 1] = "Print";
|
|
@@ -2026,7 +2043,7 @@ export {
|
|
|
2026
2043
|
PdfPageFlattenFlag,
|
|
2027
2044
|
PdfPageFlattenResult,
|
|
2028
2045
|
PdfPageObjectType,
|
|
2029
|
-
|
|
2046
|
+
PdfPermissionFlag,
|
|
2030
2047
|
PdfSegmentObjectType,
|
|
2031
2048
|
PdfSoftHyphenMarker,
|
|
2032
2049
|
PdfStampFit,
|
|
@@ -2042,6 +2059,7 @@ export {
|
|
|
2042
2059
|
PdfZeroWidthSpace,
|
|
2043
2060
|
PdfZoomMode,
|
|
2044
2061
|
PerfLogger,
|
|
2062
|
+
PermissionDeniedError,
|
|
2045
2063
|
Rotation,
|
|
2046
2064
|
STANDARD_FONT_FAMILIES,
|
|
2047
2065
|
Task,
|
|
@@ -2053,6 +2071,7 @@ export {
|
|
|
2053
2071
|
blendModeToCss,
|
|
2054
2072
|
blendModeValues,
|
|
2055
2073
|
boundingRect,
|
|
2074
|
+
buildPermissions,
|
|
2056
2075
|
buildUserToDeviceMatrix,
|
|
2057
2076
|
calculateAngle,
|
|
2058
2077
|
calculateDegree,
|