Telemetry for used stream and font types

This commit is contained in:
Yury Delendik 2014-06-16 09:52:04 -05:00
parent 7ac1c6b034
commit 0cd28ebfa3
11 changed files with 174 additions and 24 deletions

View file

@ -164,6 +164,14 @@ PDFJS.maxCanvasPixels = (PDFJS.maxCanvasPixels === undefined ?
* loaded before the switch to range requests.
*/
/**
* @typedef {Object} PDFDocumentStats
* @property {Array} streamTypes - Used stream types in the document (an item
* is set to true if specific stream ID was used in the document).
* @property {Array} fontTypes - Used font type in the document (an item is set
* to true if specific font ID was used in the document).
*/
/**
* This is the main entry point for loading a PDF and interacting with it.
* NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR)
@ -331,6 +339,13 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {
getDownloadInfo: function PDFDocumentProxy_getDownloadInfo() {
return this.transport.downloadInfoCapability.promise;
},
/**
* @returns {Promise} A promise this is resolved with current stats about
* document structures (see {@link PDFDocumentStats}).
*/
getStats: function PDFDocumentProxy_getStats() {
return this.transport.getStats();
},
/**
* Cleans up resources allocated by the document, e.g. created @font-face.
*/
@ -1056,6 +1071,10 @@ var WorkerTransport = (function WorkerTransportClosure() {
});
},
getStats: function WorkerTransport_getStats() {
return this.messageHandler.sendWithPromise('GetStats', null);
},
startCleanup: function WorkerTransport_startCleanup() {
this.messageHandler.sendWithPromise('Cleanup', null).
then(function endCleanup() {