Skip to content

Commit 008d693

Browse files
author
Brendan Dahl
committed
Collect telemetry in the viewer on whether a PDF is tagged.
1 parent 5e64e1b commit 008d693

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

web/app.js

+21
Original file line numberDiff line numberDiff line change
@@ -1329,12 +1329,33 @@ const PDFViewerApplication = {
13291329
pdfViewer.optionalContentConfigPromise.then(optionalContentConfig => {
13301330
this.pdfLayerViewer.render({ optionalContentConfig, pdfDocument });
13311331
});
1332+
if ("requestIdleCallback" in window) {
1333+
window.requestIdleCallback(() => {
1334+
this._collectTelemetry();
1335+
});
1336+
}
13321337
});
13331338

13341339
this._initializePageLabels(pdfDocument);
13351340
this._initializeMetadata(pdfDocument);
13361341
},
13371342

1343+
/**
1344+
* A place to fetch data for telemetry after one page is rendered and the
1345+
* viewer is idle.
1346+
*/
1347+
async _collectTelemetry() {
1348+
if (!this.pdfDocument) {
1349+
return;
1350+
}
1351+
const markInfo = await this.pdfDocument.getMarkInfo();
1352+
const tagged = markInfo ? markInfo.Marked : false;
1353+
this.externalServices.reportTelemetry({
1354+
type: "tagged",
1355+
tagged,
1356+
});
1357+
},
1358+
13381359
/**
13391360
* @private
13401361
*/

0 commit comments

Comments
 (0)