@libpdf/core 0.3.1 → 0.3.3
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.mjs +16 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import { createCMSECDSASignature } from "pkijs";
|
|
|
11
11
|
import { base64 } from "@scure/base";
|
|
12
12
|
|
|
13
13
|
//#region package.json
|
|
14
|
-
var version = "0.3.
|
|
14
|
+
var version = "0.3.3";
|
|
15
15
|
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/objects/pdf-array.ts
|
|
@@ -27267,7 +27267,7 @@ var PDFPage = class PDFPage {
|
|
|
27267
27267
|
const ops = [pushGraphicsState()];
|
|
27268
27268
|
if (gsName) ops.push(setGraphicsState(`/${gsName}`));
|
|
27269
27269
|
if (options.rotate) {
|
|
27270
|
-
const textWidth = options.maxWidth ??
|
|
27270
|
+
const textWidth = options.maxWidth ?? max(lines.map((l) => l.width));
|
|
27271
27271
|
let ascent;
|
|
27272
27272
|
let descent;
|
|
27273
27273
|
if (typeof font === "string") {
|
|
@@ -34186,19 +34186,21 @@ function encryptStreamDict(stream, ctx) {
|
|
|
34186
34186
|
*/
|
|
34187
34187
|
function collectReachableRefs(registry, root, info, encrypt) {
|
|
34188
34188
|
const visited = /* @__PURE__ */ new Set();
|
|
34189
|
-
const
|
|
34190
|
-
|
|
34189
|
+
const stack = [root];
|
|
34190
|
+
if (info) stack.push(info);
|
|
34191
|
+
if (encrypt) stack.push(encrypt);
|
|
34192
|
+
while (stack.length > 0) {
|
|
34193
|
+
const obj = stack.pop();
|
|
34191
34194
|
if (obj instanceof PdfRef) {
|
|
34192
34195
|
const key$1 = `${obj.objectNumber} ${obj.generation}`;
|
|
34193
|
-
if (visited.has(key$1))
|
|
34196
|
+
if (visited.has(key$1)) continue;
|
|
34194
34197
|
visited.add(key$1);
|
|
34195
|
-
|
|
34196
|
-
|
|
34197
|
-
else if (obj instanceof
|
|
34198
|
-
|
|
34199
|
-
|
|
34200
|
-
|
|
34201
|
-
if (encrypt) walk(encrypt);
|
|
34198
|
+
const resolved = registry.resolve(obj);
|
|
34199
|
+
if (resolved !== null) stack.push(resolved);
|
|
34200
|
+
} else if (obj instanceof PdfDict) {
|
|
34201
|
+
for (const [, value] of obj) if (value != null) stack.push(value);
|
|
34202
|
+
} else if (obj instanceof PdfArray) for (const item of obj) stack.push(item);
|
|
34203
|
+
}
|
|
34202
34204
|
return visited;
|
|
34203
34205
|
}
|
|
34204
34206
|
/**
|
|
@@ -34276,7 +34278,7 @@ function writeComplete(registry, options) {
|
|
|
34276
34278
|
});
|
|
34277
34279
|
writeXRefStream(writer, {
|
|
34278
34280
|
entries,
|
|
34279
|
-
size:
|
|
34281
|
+
size: max(entries.map((e) => e.objectNumber), 0) + 1,
|
|
34280
34282
|
xrefOffset,
|
|
34281
34283
|
root: options.root,
|
|
34282
34284
|
info: options.info,
|
|
@@ -34286,7 +34288,7 @@ function writeComplete(registry, options) {
|
|
|
34286
34288
|
});
|
|
34287
34289
|
} else writeXRefTable(writer, {
|
|
34288
34290
|
entries,
|
|
34289
|
-
size:
|
|
34291
|
+
size: max(entries.map((e) => e.objectNumber), 0) + 1,
|
|
34290
34292
|
xrefOffset,
|
|
34291
34293
|
root: options.root,
|
|
34292
34294
|
info: options.info,
|