@libpdf/core 0.0.1-beta.11 → 0.0.1-beta.12

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 CHANGED
@@ -9,7 +9,7 @@ import { createCMSECDSASignature } from "pkijs";
9
9
  import { base64 } from "@scure/base";
10
10
 
11
11
  //#region package.json
12
- var version = "0.0.1-beta.11";
12
+ var version = "0.0.1-beta.12";
13
13
 
14
14
  //#endregion
15
15
  //#region src/objects/pdf-array.ts
@@ -26323,8 +26323,7 @@ var AnnotationFlattener = class {
26323
26323
  * Wrap existing page content in q...Q and append new content.
26324
26324
  */
26325
26325
  wrapAndAppendContent(page, newContent) {
26326
- let existing = page.get("Contents");
26327
- if (existing instanceof PdfRef) existing = this.registry.resolve(existing) ?? void 0;
26326
+ const existing = page.get("Contents");
26328
26327
  const prefixBytes = new Uint8Array([113, 10]);
26329
26328
  const prefixStream = new PdfStream(new PdfDict(), prefixBytes);
26330
26329
  const prefixRef = this.registry.register(prefixStream);
@@ -26338,10 +26337,12 @@ var AnnotationFlattener = class {
26338
26337
  page.set("Contents", suffixRef);
26339
26338
  return;
26340
26339
  }
26341
- if (existing instanceof PdfArray) {
26340
+ let resolved = existing;
26341
+ if (existing instanceof PdfRef) resolved = this.registry.resolve(existing) ?? existing;
26342
+ if (resolved instanceof PdfArray) {
26342
26343
  const items = [];
26343
- for (let i = 0; i < existing.length; i++) {
26344
- const item = existing.at(i);
26344
+ for (let i = 0; i < resolved.length; i++) {
26345
+ const item = resolved.at(i);
26345
26346
  if (item instanceof PdfRef) items.push(item);
26346
26347
  }
26347
26348
  const newArray = PdfArray.of(prefixRef, ...items, suffixRef);