@libpdf/core 0.1.0 → 0.1.1

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.d.mts CHANGED
@@ -332,7 +332,7 @@ declare class PdfDict implements PdfPrimitive {
332
332
  /**
333
333
  * Get value for key. Key can be string or PdfName.
334
334
  */
335
- get(key: PdfName | string): PdfObject | undefined;
335
+ get(key: PdfName | string, resolver?: RefResolver): PdfObject | undefined;
336
336
  /**
337
337
  * Set value for key. Key can be string or PdfName.
338
338
  */
@@ -354,15 +354,19 @@ declare class PdfDict implements PdfPrimitive {
354
354
  */
355
355
  [Symbol.iterator](): Iterator<[PdfName, PdfObject]>;
356
356
  /**
357
- * Typed getters
357
+ * Typed getters.
358
+ *
359
+ * All typed getters accept an optional resolver function. When provided,
360
+ * if the value is a PdfRef, it will be automatically dereferenced.
361
+ * This prevents the common bug of forgetting to handle indirect references.
358
362
  */
359
- getName(key: string): PdfName | undefined;
360
- getNumber(key: string): PdfNumber | undefined;
361
- getString(key: string): PdfString | undefined;
362
- getArray(key: string): PdfArray | undefined;
363
- getDict(key: string): PdfDict | undefined;
363
+ getName(key: string, resolver?: RefResolver): PdfName | undefined;
364
+ getNumber(key: string, resolver?: RefResolver): PdfNumber | undefined;
365
+ getString(key: string, resolver?: RefResolver): PdfString | undefined;
366
+ getArray(key: string, resolver?: RefResolver): PdfArray | undefined;
367
+ getDict(key: string, resolver?: RefResolver): PdfDict | undefined;
364
368
  getRef(key: string): PdfRef | undefined;
365
- getBool(key: string): PdfBool | undefined;
369
+ getBool(key: string, resolver?: RefResolver): PdfBool | undefined;
366
370
  /**
367
371
  * Create a shallow clone of this dictionary.
368
372
  * Values are shared, not deep-copied.
@@ -518,6 +522,19 @@ declare class PdfStream extends PdfDict {
518
522
  */
519
523
  type PdfObject = PdfNull | PdfBool | PdfNumber | PdfName | PdfString | PdfRef | PdfArray | PdfDict | PdfStream | PdfRaw;
520
524
  //#endregion
525
+ //#region src/helpers/types.d.ts
526
+ /**
527
+ * Function type for resolving a PdfRef to its target PdfObject.
528
+ *
529
+ * This is the standard resolver signature used throughout the library
530
+ * for dereferencing indirect object references. All PDF data is loaded
531
+ * into memory at parse time, so resolution is synchronous.
532
+ *
533
+ * @param ref - The indirect reference to resolve
534
+ * @returns The resolved object, or null if not found
535
+ */
536
+ type RefResolver = (ref: PdfRef) => PdfObject | null;
537
+ //#endregion
521
538
  //#region src/io/scanner.d.ts
522
539
  /**
523
540
  * Scanner - the lowest-level byte reader for PDF parsing.
@@ -595,15 +612,6 @@ type XRefEntry = {
595
612
  };
596
613
  //#endregion
597
614
  //#region src/document/object-registry.d.ts
598
- /**
599
- * Function to resolve objects not yet in the registry.
600
- * Called when resolve() encounters an unknown reference.
601
- *
602
- * This is synchronous because all PDF data is loaded into memory
603
- * at parse time. The resolver simply parses objects on demand from
604
- * the in-memory buffer.
605
- */
606
- type ObjectResolver = (ref: PdfRef) => PdfObject | null;
607
615
  /**
608
616
  * Registry for managing PDF objects and their references.
609
617
  *
@@ -637,7 +645,7 @@ declare class ObjectRegistry {
637
645
  /**
638
646
  * Set the resolver for fetching objects not yet in the registry.
639
647
  */
640
- setResolver(resolver: ObjectResolver): void;
648
+ setResolver(resolver: RefResolver): void;
641
649
  /**
642
650
  * Get the next object number that will be assigned.
643
651
  */
@@ -4502,12 +4510,6 @@ declare class StandardSecurityHandler {
4502
4510
  }
4503
4511
  //#endregion
4504
4512
  //#region src/document/name-tree.d.ts
4505
- /**
4506
- * Function to resolve a reference to its object.
4507
- *
4508
- * Synchronous because all PDF data is loaded into memory at parse time.
4509
- */
4510
- type Resolver = (ref: PdfRef) => PdfObject | null;
4511
4513
  /**
4512
4514
  * PDF Name Tree reader.
4513
4515
  *
@@ -4518,7 +4520,7 @@ declare class NameTree {
4518
4520
  private readonly root;
4519
4521
  private readonly resolver;
4520
4522
  private cache;
4521
- constructor(root: PdfDict, resolver: Resolver);
4523
+ constructor(root: PdfDict, resolver: RefResolver);
4522
4524
  /**
4523
4525
  * Lookup a single key using binary search.
4524
4526
  * Uses /Limits on intermediate nodes to skip subtrees.
@@ -4625,7 +4627,7 @@ declare class PDFPageTree {
4625
4627
  /**
4626
4628
  * Load and build the page tree by walking from the root.
4627
4629
  */
4628
- static load(pagesRef: PdfRef, getObject: (ref: PdfRef) => PdfObject | null): PDFPageTree;
4630
+ static load(pagesRef: PdfRef, getObject: RefResolver): PDFPageTree;
4629
4631
  /**
4630
4632
  * Create an empty page tree.
4631
4633
  * Note: This creates a minimal tree without a backing PDF structure.
@@ -4756,10 +4758,6 @@ declare class PDFContext {
4756
4758
  * so this operation never requires I/O.
4757
4759
  */
4758
4760
  resolve(ref: PdfRef): PdfObject | null;
4759
- /**
4760
- * Get an object by reference (sync, only if already loaded).
4761
- */
4762
- getObject(ref: PdfRef): PdfObject | null;
4763
4761
  /**
4764
4762
  * Get the reference for an object.
4765
4763
  */
@@ -4888,8 +4886,8 @@ declare class PDFPage {
4888
4886
  /** The page index (0-based) */
4889
4887
  readonly index: number;
4890
4888
  /** Document context for registering objects */
4891
- private readonly ctx?;
4892
- constructor(ref: PdfRef, dict: PdfDict, index: number, ctx?: PDFContext);
4889
+ private readonly ctx;
4890
+ constructor(ref: PdfRef, dict: PdfDict, index: number, ctx: PDFContext);
4893
4891
  /**
4894
4892
  * Get the MediaBox (page boundary).
4895
4893
  *
@@ -4962,7 +4960,9 @@ declare class PDFPage {
4962
4960
  /**
4963
4961
  * Get the page's Resources dictionary.
4964
4962
  *
4965
- * Creates an empty one if it doesn't exist.
4963
+ * If Resources is a reference, it's dereferenced.
4964
+ * If Resources doesn't exist or is inherited from a parent,
4965
+ * a new empty dict is created on this page.
4966
4966
  */
4967
4967
  getResources(): PdfDict;
4968
4968
  /**
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.1.0";
12
+ var version = "0.1.1";
13
13
 
14
14
  //#endregion
15
15
  //#region src/objects/pdf-array.ts
@@ -403,6 +403,69 @@ var PdfName = class PdfName {
403
403
  }
404
404
  };
405
405
 
406
+ //#endregion
407
+ //#region src/objects/pdf-ref.ts
408
+ /**
409
+ * Default cache size for PdfRef interning.
410
+ * Object references tend to be more numerous than names in typical PDFs.
411
+ */
412
+ const DEFAULT_REF_CACHE_SIZE = 2e4;
413
+ /**
414
+ * PDF indirect reference (interned).
415
+ *
416
+ * In PDF: `1 0 R`, `42 0 R`
417
+ *
418
+ * References are interned using an LRU cache to prevent unbounded memory growth.
419
+ * `PdfRef.of(1, 0) === PdfRef.of(1, 0)` as long as both are in cache.
420
+ * Use `.of()` to get or create instances.
421
+ */
422
+ var PdfRef = class PdfRef {
423
+ get type() {
424
+ return "ref";
425
+ }
426
+ static cache = new LRUCache(DEFAULT_REF_CACHE_SIZE);
427
+ constructor(objectNumber, generation) {
428
+ this.objectNumber = objectNumber;
429
+ this.generation = generation;
430
+ }
431
+ /**
432
+ * Get or create an interned PdfRef for the given object/generation pair.
433
+ */
434
+ static of(objectNumber, generation = 0) {
435
+ const key$1 = `${objectNumber} ${generation}`;
436
+ let cached = PdfRef.cache.get(key$1);
437
+ if (!cached) {
438
+ cached = new PdfRef(objectNumber, generation);
439
+ PdfRef.cache.set(key$1, cached);
440
+ }
441
+ return cached;
442
+ }
443
+ /**
444
+ * Clear the reference cache.
445
+ *
446
+ * Useful for long-running applications that process many PDFs
447
+ * and want to reclaim memory between documents.
448
+ */
449
+ static clearCache() {
450
+ PdfRef.cache.clear();
451
+ }
452
+ /**
453
+ * Get the current size of the LRU cache.
454
+ */
455
+ static get cacheSize() {
456
+ return PdfRef.cache.size;
457
+ }
458
+ /**
459
+ * Returns the PDF syntax representation: "1 0 R"
460
+ */
461
+ toString() {
462
+ return `${this.objectNumber} ${this.generation} R`;
463
+ }
464
+ toBytes(writer) {
465
+ writer.writeAscii(`${this.objectNumber} ${this.generation} R`);
466
+ }
467
+ };
468
+
406
469
  //#endregion
407
470
  //#region src/objects/pdf-dict.ts
408
471
  /**
@@ -441,9 +504,11 @@ var PdfDict = class PdfDict {
441
504
  /**
442
505
  * Get value for key. Key can be string or PdfName.
443
506
  */
444
- get(key$1) {
507
+ get(key$1, resolver) {
445
508
  const name = typeof key$1 === "string" ? PdfName.of(key$1) : key$1;
446
- return this.entries.get(name);
509
+ const value = this.entries.get(name);
510
+ if (resolver && value?.type === "ref") return resolver(value) ?? void 0;
511
+ return value;
447
512
  }
448
513
  /**
449
514
  * Set value for key. Key can be string or PdfName.
@@ -482,34 +547,38 @@ var PdfDict = class PdfDict {
482
547
  yield* this.entries;
483
548
  }
484
549
  /**
485
- * Typed getters
550
+ * Typed getters.
551
+ *
552
+ * All typed getters accept an optional resolver function. When provided,
553
+ * if the value is a PdfRef, it will be automatically dereferenced.
554
+ * This prevents the common bug of forgetting to handle indirect references.
486
555
  */
487
- getName(key$1) {
488
- const value = this.get(key$1);
556
+ getName(key$1, resolver) {
557
+ const value = this.get(key$1, resolver);
489
558
  return value?.type === "name" ? value : void 0;
490
559
  }
491
- getNumber(key$1) {
492
- const value = this.get(key$1);
560
+ getNumber(key$1, resolver) {
561
+ const value = this.get(key$1, resolver);
493
562
  return value?.type === "number" ? value : void 0;
494
563
  }
495
- getString(key$1) {
496
- const value = this.get(key$1);
564
+ getString(key$1, resolver) {
565
+ const value = this.get(key$1, resolver);
497
566
  return value?.type === "string" ? value : void 0;
498
567
  }
499
- getArray(key$1) {
500
- const value = this.get(key$1);
568
+ getArray(key$1, resolver) {
569
+ const value = this.get(key$1, resolver);
501
570
  return value?.type === "array" ? value : void 0;
502
571
  }
503
- getDict(key$1) {
504
- const value = this.get(key$1);
572
+ getDict(key$1, resolver) {
573
+ const value = this.get(key$1, resolver);
505
574
  return value?.type === "dict" ? value : void 0;
506
575
  }
507
576
  getRef(key$1) {
508
577
  const value = this.get(key$1);
509
578
  return value?.type === "ref" ? value : void 0;
510
579
  }
511
- getBool(key$1) {
512
- const value = this.get(key$1);
580
+ getBool(key$1, resolver) {
581
+ const value = this.get(key$1, resolver);
513
582
  return value?.type === "bool" ? value : void 0;
514
583
  }
515
584
  /**
@@ -2589,69 +2658,6 @@ const drawXObject = (name) => Operator.of(Op.DrawXObject, name);
2589
2658
  const beginMarkedContent = (tag) => Operator.of(Op.BeginMarkedContent, tag);
2590
2659
  const endMarkedContent = () => Operator.of(Op.EndMarkedContent);
2591
2660
 
2592
- //#endregion
2593
- //#region src/objects/pdf-ref.ts
2594
- /**
2595
- * Default cache size for PdfRef interning.
2596
- * Object references tend to be more numerous than names in typical PDFs.
2597
- */
2598
- const DEFAULT_REF_CACHE_SIZE = 2e4;
2599
- /**
2600
- * PDF indirect reference (interned).
2601
- *
2602
- * In PDF: `1 0 R`, `42 0 R`
2603
- *
2604
- * References are interned using an LRU cache to prevent unbounded memory growth.
2605
- * `PdfRef.of(1, 0) === PdfRef.of(1, 0)` as long as both are in cache.
2606
- * Use `.of()` to get or create instances.
2607
- */
2608
- var PdfRef = class PdfRef {
2609
- get type() {
2610
- return "ref";
2611
- }
2612
- static cache = new LRUCache(DEFAULT_REF_CACHE_SIZE);
2613
- constructor(objectNumber, generation) {
2614
- this.objectNumber = objectNumber;
2615
- this.generation = generation;
2616
- }
2617
- /**
2618
- * Get or create an interned PdfRef for the given object/generation pair.
2619
- */
2620
- static of(objectNumber, generation = 0) {
2621
- const key$1 = `${objectNumber} ${generation}`;
2622
- let cached = PdfRef.cache.get(key$1);
2623
- if (!cached) {
2624
- cached = new PdfRef(objectNumber, generation);
2625
- PdfRef.cache.set(key$1, cached);
2626
- }
2627
- return cached;
2628
- }
2629
- /**
2630
- * Clear the reference cache.
2631
- *
2632
- * Useful for long-running applications that process many PDFs
2633
- * and want to reclaim memory between documents.
2634
- */
2635
- static clearCache() {
2636
- PdfRef.cache.clear();
2637
- }
2638
- /**
2639
- * Get the current size of the LRU cache.
2640
- */
2641
- static get cacheSize() {
2642
- return PdfRef.cache.size;
2643
- }
2644
- /**
2645
- * Returns the PDF syntax representation: "1 0 R"
2646
- */
2647
- toString() {
2648
- return `${this.objectNumber} ${this.generation} R`;
2649
- }
2650
- toBytes(writer) {
2651
- writer.writeAscii(`${this.objectNumber} ${this.generation} R`);
2652
- }
2653
- };
2654
-
2655
2661
  //#endregion
2656
2662
  //#region src/helpers/colors.ts
2657
2663
  /**
@@ -24321,14 +24327,16 @@ var PDFPage = class PDFPage {
24321
24327
  /**
24322
24328
  * Get the page's Resources dictionary.
24323
24329
  *
24324
- * Creates an empty one if it doesn't exist.
24330
+ * If Resources is a reference, it's dereferenced.
24331
+ * If Resources doesn't exist or is inherited from a parent,
24332
+ * a new empty dict is created on this page.
24325
24333
  */
24326
24334
  getResources() {
24327
24335
  let resources = this.dict.get("Resources");
24328
- if (!(resources instanceof PdfDict)) {
24329
- resources = new PdfDict();
24330
- this.dict.set("Resources", resources);
24331
- }
24336
+ if (resources instanceof PdfRef) resources = this.ctx.resolve(resources) ?? void 0;
24337
+ if (resources instanceof PdfDict) return resources;
24338
+ resources = new PdfDict();
24339
+ this.dict.set("Resources", resources);
24332
24340
  return resources;
24333
24341
  }
24334
24342
  /**
@@ -24458,7 +24466,6 @@ var PDFPage = class PDFPage {
24458
24466
  * ```
24459
24467
  */
24460
24468
  drawField(field, options) {
24461
- if (!this.ctx) throw new Error("Cannot draw field on page without context");
24462
24469
  if (!(field instanceof TerminalField)) throw new Error(`Cannot draw non-terminal field "${field.name}"`);
24463
24470
  if (field instanceof SignatureField) throw new Error("Signature fields cannot be drawn with drawField. Use form.createSignatureField() which creates the widget automatically.");
24464
24471
  if (field instanceof RadioField) {
@@ -24543,7 +24550,6 @@ var PDFPage = class PDFPage {
24543
24550
  * Generate appearance stream for a widget.
24544
24551
  */
24545
24552
  generateWidgetAppearance(field, widget, options) {
24546
- if (!this.ctx) return;
24547
24553
  const catalogDict = this.ctx.catalog.getDict();
24548
24554
  const acroForm = AcroForm.load(catalogDict, this.ctx.registry);
24549
24555
  if (!acroForm) return;
@@ -25193,7 +25199,6 @@ var PDFPage = class PDFPage {
25193
25199
  * Add a text markup annotation (internal helper).
25194
25200
  */
25195
25201
  addTextMarkupAnnotation(subtype, options) {
25196
- if (!this.ctx) throw new Error("Cannot add annotation to page without context");
25197
25202
  let annotDict;
25198
25203
  switch (subtype) {
25199
25204
  case "Highlight":
@@ -25242,7 +25247,6 @@ var PDFPage = class PDFPage {
25242
25247
  * ```
25243
25248
  */
25244
25249
  addLinkAnnotation(options) {
25245
- if (!this.ctx) throw new Error("Cannot add annotation to page without context");
25246
25250
  const destination = options.destination;
25247
25251
  if (destination) {
25248
25252
  const destinationPage = destination.page;
@@ -25262,7 +25266,6 @@ var PDFPage = class PDFPage {
25262
25266
  * @returns The created annotation
25263
25267
  */
25264
25268
  addTextAnnotation(options) {
25265
- if (!this.ctx) throw new Error("Cannot add annotation to page without context");
25266
25269
  const annotDict = PDFTextAnnotation.create(options);
25267
25270
  const annotRef = this.ctx.register(annotDict);
25268
25271
  this.addAnnotationRef(annotRef);
@@ -25275,7 +25278,6 @@ var PDFPage = class PDFPage {
25275
25278
  * @returns The created annotation
25276
25279
  */
25277
25280
  addLineAnnotation(options) {
25278
- if (!this.ctx) throw new Error("Cannot add annotation to page without context");
25279
25281
  const annotDict = PDFLineAnnotation.create(options);
25280
25282
  const annotRef = this.ctx.register(annotDict);
25281
25283
  this.addAnnotationRef(annotRef);
@@ -25288,7 +25290,6 @@ var PDFPage = class PDFPage {
25288
25290
  * @returns The created annotation
25289
25291
  */
25290
25292
  addSquareAnnotation(options) {
25291
- if (!this.ctx) throw new Error("Cannot add annotation to page without context");
25292
25293
  const annotDict = PDFSquareAnnotation.create(options);
25293
25294
  const annotRef = this.ctx.register(annotDict);
25294
25295
  this.addAnnotationRef(annotRef);
@@ -25301,7 +25302,6 @@ var PDFPage = class PDFPage {
25301
25302
  * @returns The created annotation
25302
25303
  */
25303
25304
  addCircleAnnotation(options) {
25304
- if (!this.ctx) throw new Error("Cannot add annotation to page without context");
25305
25305
  const annotDict = PDFCircleAnnotation.create(options);
25306
25306
  const annotRef = this.ctx.register(annotDict);
25307
25307
  this.addAnnotationRef(annotRef);
@@ -25314,7 +25314,6 @@ var PDFPage = class PDFPage {
25314
25314
  * @returns The created annotation
25315
25315
  */
25316
25316
  addStampAnnotation(options) {
25317
- if (!this.ctx) throw new Error("Cannot add annotation to page without context");
25318
25317
  const annotDict = PDFStampAnnotation.create(options);
25319
25318
  const annotRef = this.ctx.register(annotDict);
25320
25319
  this.addAnnotationRef(annotRef);
@@ -25327,7 +25326,6 @@ var PDFPage = class PDFPage {
25327
25326
  * @returns The created annotation
25328
25327
  */
25329
25328
  addInkAnnotation(options) {
25330
- if (!this.ctx) throw new Error("Cannot add annotation to page without context");
25331
25329
  const annotDict = PDFInkAnnotation.create(options);
25332
25330
  const annotRef = this.ctx.register(annotDict);
25333
25331
  this.addAnnotationRef(annotRef);
@@ -25347,7 +25345,6 @@ var PDFPage = class PDFPage {
25347
25345
  * ```
25348
25346
  */
25349
25347
  removeAnnotation(annotation) {
25350
- if (!this.ctx) return;
25351
25348
  const annots = this.dict.getArray("Annots");
25352
25349
  if (!annots) return;
25353
25350
  const removeMatchingEntry = (predicate) => {
@@ -25409,7 +25406,6 @@ var PDFPage = class PDFPage {
25409
25406
  * ```
25410
25407
  */
25411
25408
  flattenAnnotations(options) {
25412
- if (!this.ctx) return 0;
25413
25409
  const count = new AnnotationFlattener(this.ctx.registry).flattenPage(this.dict, options);
25414
25410
  this.invalidateAnnotationCache();
25415
25411
  return count;
@@ -25623,7 +25619,6 @@ var PDFPage = class PDFPage {
25623
25619
  return fontName;
25624
25620
  }
25625
25621
  if (font instanceof EmbeddedFont) {
25626
- if (!this.ctx) throw new Error("Cannot use embedded fonts without document context");
25627
25622
  const fontRef = this.ctx.getFontRef(font);
25628
25623
  for (const [existingName, value] of fonts) if (value instanceof PdfRef && value.objectNumber === fontRef.objectNumber && value.generation === fontRef.generation) return existingName.value;
25629
25624
  const fontName = this.generateUniqueName(fonts, "F");
@@ -25747,7 +25742,6 @@ var PDFPage = class PDFPage {
25747
25742
  * This method checks the page first, then walks up the Parent chain.
25748
25743
  */
25749
25744
  resolveInheritedResources() {
25750
- if (!this.ctx) return null;
25751
25745
  let currentDict = this.dict;
25752
25746
  while (currentDict) {
25753
25747
  const resourcesEntry = currentDict.get("Resources");
@@ -25801,7 +25795,6 @@ var PDFPage = class PDFPage {
25801
25795
  const resolvedRefs = /* @__PURE__ */ new Map();
25802
25796
  const decodedStreams = /* @__PURE__ */ new Map();
25803
25797
  const preResolveValue = (value) => {
25804
- if (!this.ctx) return;
25805
25798
  if (value instanceof PdfRef) {
25806
25799
  const key$1 = `${value.objectNumber} ${value.generation} R`;
25807
25800
  if (resolvedRefs.has(key$1)) return;
@@ -25824,10 +25817,7 @@ var PDFPage = class PDFPage {
25824
25817
  const pdfFont = parseFont(fontDictEntry, {
25825
25818
  resolveRef: (ref) => {
25826
25819
  if (ref instanceof PdfRef && this.ctx) {
25827
- const key$1 = `${ref.objectNumber} ${ref.generation} R`;
25828
- const preResolved = resolvedRefs.get(key$1);
25829
- if (preResolved) return preResolved;
25830
- const obj = this.ctx.getObject(ref);
25820
+ const obj = this.ctx.resolve(ref);
25831
25821
  if (obj instanceof PdfDict || obj instanceof PdfArray || obj instanceof PdfStream) return obj;
25832
25822
  }
25833
25823
  return null;
@@ -31838,22 +31828,6 @@ function createFileSpec(filename, embeddedFileRef, options = {}) {
31838
31828
  //#endregion
31839
31829
  //#region src/document/name-tree.ts
31840
31830
  /**
31841
- * PDF Name Tree implementation.
31842
- *
31843
- * Name trees are sorted key-value structures used for:
31844
- * - /EmbeddedFiles (attachments)
31845
- * - /Dests (named destinations)
31846
- * - /JavaScript (document-level scripts)
31847
- * - /AP (appearance streams)
31848
- *
31849
- * Structure:
31850
- * - Leaf nodes have /Names: [key1, value1, key2, value2, ...]
31851
- * - Intermediate nodes have /Kids: [ref1, ref2, ...]
31852
- * - Intermediate nodes have /Limits: [minKey, maxKey] for binary search
31853
- *
31854
- * @see PDF 1.7 spec section 7.9.6
31855
- */
31856
- /**
31857
31831
  * Maximum depth for tree traversal (prevents infinite loops on malformed PDFs).
31858
31832
  */
31859
31833
  const MAX_DEPTH = 10;
@@ -32406,12 +32380,6 @@ var PDFContext = class {
32406
32380
  return this.registry.resolve(ref);
32407
32381
  }
32408
32382
  /**
32409
- * Get an object by reference (sync, only if already loaded).
32410
- */
32411
- getObject(ref) {
32412
- return this.registry.getObject(ref);
32413
- }
32414
- /**
32415
32383
  * Get the reference for an object.
32416
32384
  */
32417
32385
  getRef(obj) {