Add telemetry for tagged pdfs (bug 1997134)
This commit is contained in:
parent
603e3a8f3e
commit
50c48cf11b
@ -267,6 +267,10 @@ class Catalog {
|
||||
return markInfo;
|
||||
}
|
||||
|
||||
get hasStructTree() {
|
||||
return this.#catDict.has("StructTreeRoot");
|
||||
}
|
||||
|
||||
get structTreeRoot() {
|
||||
let structTree = null;
|
||||
try {
|
||||
|
||||
@ -515,6 +515,7 @@ class WorkerMessageHandler {
|
||||
return Promise.all([
|
||||
pdfManager.ensureDoc("documentInfo"),
|
||||
pdfManager.ensureCatalog("metadata"),
|
||||
pdfManager.ensureCatalog("hasStructTree"),
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
13
web/app.js
13
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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user