@libpdf/core 0.3.1 → 0.3.2
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 +13 -11
- 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.2";
|
|
15
15
|
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/objects/pdf-array.ts
|
|
@@ -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
|
/**
|