From b3e16800f5123d9b881b7cf6d07860af992d434f Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 3 May 2025 13:35:26 +0200 Subject: [PATCH] Remove the `BasePdfManager.prototype.catalog` getter This is only invoked *once* and it can be trivially replaced by the `ensureCatalog`-method, since the code where it's used is already asynchronous. --- src/core/pdf_manager.js | 4 ---- src/core/struct_tree.js | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/core/pdf_manager.js b/src/core/pdf_manager.js index 8b13dfbff..0246c26bf 100644 --- a/src/core/pdf_manager.js +++ b/src/core/pdf_manager.js @@ -95,10 +95,6 @@ class BasePdfManager { return this._docBaseUrl; } - get catalog() { - return this.pdfDocument.catalog; - } - ensureDoc(prop, args) { return this.ensure(this.pdfDocument, prop, args); } diff --git a/src/core/struct_tree.js b/src/core/struct_tree.js index 59ba40cb6..f8eafbc17 100644 --- a/src/core/struct_tree.js +++ b/src/core/struct_tree.js @@ -118,7 +118,7 @@ class StructTreeRoot { pdfManager, changes, }) { - const root = pdfManager.catalog.cloneDict(); + const root = await pdfManager.ensureCatalog("cloneDict"); const cache = new RefSetCache(); cache.put(catalogRef, root);