diff --git a/src/core/catalog.js b/src/core/catalog.js index 5b5b319c7..3f73e6d91 100644 --- a/src/core/catalog.js +++ b/src/core/catalog.js @@ -267,6 +267,10 @@ class Catalog { return markInfo; } + get hasStructTree() { + return this.#catDict.has("StructTreeRoot"); + } + get structTreeRoot() { let structTree = null; try { diff --git a/src/core/worker.js b/src/core/worker.js index 8ef7b10f4..1b6accb85 100644 --- a/src/core/worker.js +++ b/src/core/worker.js @@ -515,6 +515,7 @@ class WorkerMessageHandler { return Promise.all([ pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata"), + pdfManager.ensureCatalog("hasStructTree"), ]); }); diff --git a/src/display/api.js b/src/display/api.js index b279df994..75ed964d3 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -3077,6 +3077,7 @@ class WorkerTransport { metadata: results[1] ? new Metadata(results[1]) : null, contentDispositionFilename: this._fullReader?.filename ?? null, contentLength: this._fullReader?.contentLength ?? null, + hasStructTree: results[2], })); this.#methodPromises.set(name, promise); return promise; diff --git a/web/app.js b/web/app.js index a9a6e8d88..3d6b122f0 100644 --- a/web/app.js +++ b/web/app.js @@ -1719,12 +1719,21 @@ const PDFViewerApplication = { * @private */ async _initializeMetadata(pdfDocument) { - const { info, metadata, contentDispositionFilename, contentLength } = - await pdfDocument.getMetadata(); + const { + info, + metadata, + contentDispositionFilename, + contentLength, + hasStructTree, + } = await pdfDocument.getMetadata(); if (pdfDocument !== this.pdfDocument) { return; // The document was closed while the metadata resolved. } + this.externalServices.reportTelemetry({ + type: "taggedPDF", + data: hasStructTree, + }); this.documentInfo = info; this.metadata = metadata; this._contentDispositionFilename ??= contentDispositionFilename;