1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

Make getOperatorList() calls independent and merge queues at end

This commit is contained in:
Mack Duan 2013-04-08 15:14:56 -07:00
parent 6b2c6fc223
commit dbccbaaa27
10 changed files with 1208 additions and 753 deletions

View file

@ -285,6 +285,7 @@ var WorkerMessageHandler = {
};
getPdfManager(data).then(function() {
globalScope.pdfManager = pdfManager;
loadDocument(false).then(onSuccess, function(ex) {
// Try again with recoveryMode == true
if (!(ex instanceof XRefParseException)) {
@ -358,10 +359,11 @@ var WorkerMessageHandler = {
var pageNum = data.pageIndex + 1;
var start = Date.now();
var dependency = [];
// Pre compile the pdf page and fetch the fonts/images.
pdfManager.ensure(page, 'getOperatorList', handler,
dependency).then(function(operatorList) {
page.getOperatorList(handler).then(function(opListData) {
var operatorList = opListData.queue;
var dependency = Object.keys(opListData.dependencies);
// The following code does quite the same as
// Page.prototype.startRendering, but stops at one point and sends the
@ -420,8 +422,7 @@ var WorkerMessageHandler = {
pdfManager.getPage(data.pageIndex).then(function(page) {
var pageNum = data.pageIndex + 1;
var start = Date.now();
pdfManager.ensure(page,
'extractTextContent').then(function(textContent) {
page.extractTextContent().then(function(textContent) {
promise.resolve(textContent);
log('text indexing: page=%d - time=%dms', pageNum,
Date.now() - start);