Browse Source

PDF.js version 1.8.342 - See mozilla/pdf.js@52998c5fe1a3d74b47de6474b9b4a99346379e1a

pdfjsbot 8 years ago
parent
commit
5099b70355

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "pdfjs-dist",
-  "version": "1.8.339",
+  "version": "1.8.342",
   "main": [
     "build/pdf.js",
     "build/pdf.worker.js"

+ 6 - 6
build/pdf.combined.js

@@ -12792,8 +12792,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
 }();
 var version, build;
 {
-  exports.version = version = '1.8.339';
-  exports.build = build = '9bfbf27f';
+  exports.version = version = '1.8.342';
+  exports.build = build = '52998c5f';
 }
 exports.getDocument = getDocument;
 exports.LoopbackPort = LoopbackPort;
@@ -28199,8 +28199,8 @@ if (!_util.globalScope.PDFJS) {
 }
 var PDFJS = _util.globalScope.PDFJS;
 {
-  PDFJS.version = '1.8.339';
-  PDFJS.build = '9bfbf27f';
+  PDFJS.version = '1.8.342';
+  PDFJS.build = '52998c5f';
 }
 PDFJS.pdfBug = false;
 if (PDFJS.verbosity !== undefined) {
@@ -43786,8 +43786,8 @@ exports.TilingPattern = TilingPattern;
 "use strict";
 
 
-var pdfjsVersion = '1.8.339';
-var pdfjsBuild = '9bfbf27f';
+var pdfjsVersion = '1.8.342';
+var pdfjsBuild = '52998c5f';
 var pdfjsSharedUtil = __w_pdfjs_require__(0);
 var pdfjsDisplayGlobal = __w_pdfjs_require__(26);
 var pdfjsDisplayAPI = __w_pdfjs_require__(10);

File diff suppressed because it is too large
+ 0 - 0
build/pdf.combined.js.map


+ 6 - 6
build/pdf.js

@@ -3499,8 +3499,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
 }();
 var version, build;
 {
-  exports.version = version = '1.8.339';
-  exports.build = build = '9bfbf27f';
+  exports.version = version = '1.8.342';
+  exports.build = build = '52998c5f';
 }
 exports.getDocument = getDocument;
 exports.LoopbackPort = LoopbackPort;
@@ -5473,8 +5473,8 @@ if (!_util.globalScope.PDFJS) {
 }
 var PDFJS = _util.globalScope.PDFJS;
 {
-  PDFJS.version = '1.8.339';
-  PDFJS.build = '9bfbf27f';
+  PDFJS.version = '1.8.342';
+  PDFJS.build = '52998c5f';
 }
 PDFJS.pdfBug = false;
 if (PDFJS.verbosity !== undefined) {
@@ -7969,8 +7969,8 @@ exports.TilingPattern = TilingPattern;
 "use strict";
 
 
-var pdfjsVersion = '1.8.339';
-var pdfjsBuild = '9bfbf27f';
+var pdfjsVersion = '1.8.342';
+var pdfjsBuild = '52998c5f';
 var pdfjsSharedUtil = __w_pdfjs_require__(0);
 var pdfjsDisplayGlobal = __w_pdfjs_require__(9);
 var pdfjsDisplayAPI = __w_pdfjs_require__(3);

File diff suppressed because it is too large
+ 0 - 0
build/pdf.js.map


File diff suppressed because it is too large
+ 0 - 0
build/pdf.min.js


+ 2 - 2
build/pdf.worker.js

@@ -37144,8 +37144,8 @@ exports.Type1Parser = Type1Parser;
 "use strict";
 
 
-var pdfjsVersion = '1.8.339';
-var pdfjsBuild = '9bfbf27f';
+var pdfjsVersion = '1.8.342';
+var pdfjsBuild = '52998c5f';
 var pdfjsCoreWorker = __w_pdfjs_require__(8);
 {
   __w_pdfjs_require__(19);

File diff suppressed because it is too large
+ 0 - 0
build/pdf.worker.js.map


+ 2 - 2
lib/display/api.js

@@ -1412,8 +1412,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
 }();
 var version, build;
 {
-  exports.version = version = '1.8.339';
-  exports.build = build = '9bfbf27f';
+  exports.version = version = '1.8.342';
+  exports.build = build = '52998c5f';
 }
 exports.getDocument = getDocument;
 exports.LoopbackPort = LoopbackPort;

+ 2 - 2
lib/display/global.js

@@ -39,8 +39,8 @@ if (!_util.globalScope.PDFJS) {
 }
 var PDFJS = _util.globalScope.PDFJS;
 {
-  PDFJS.version = '1.8.339';
-  PDFJS.build = '9bfbf27f';
+  PDFJS.version = '1.8.342';
+  PDFJS.build = '52998c5f';
 }
 PDFJS.pdfBug = false;
 if (PDFJS.verbosity !== undefined) {

+ 2 - 2
lib/pdf.js

@@ -14,8 +14,8 @@
  */
 'use strict';
 
-var pdfjsVersion = '1.8.339';
-var pdfjsBuild = '9bfbf27f';
+var pdfjsVersion = '1.8.342';
+var pdfjsBuild = '52998c5f';
 var pdfjsSharedUtil = require('./shared/util.js');
 var pdfjsDisplayGlobal = require('./display/global.js');
 var pdfjsDisplayAPI = require('./display/api.js');

+ 2 - 2
lib/pdf.worker.js

@@ -14,8 +14,8 @@
  */
 'use strict';
 
-var pdfjsVersion = '1.8.339';
-var pdfjsBuild = '9bfbf27f';
+var pdfjsVersion = '1.8.342';
+var pdfjsBuild = '52998c5f';
 var pdfjsCoreWorker = require('./core/worker.js');
 {
   require('./core/network.js');

+ 35 - 31
lib/web/pdf_find_controller.js

@@ -19,6 +19,8 @@ Object.defineProperty(exports, "__esModule", {
 });
 exports.PDFFindController = exports.FindStates = undefined;
 
+var _pdfjs = require('./pdfjs');
+
 var _ui_utils = require('./ui_utils');
 
 var FindStates = {
@@ -189,38 +191,39 @@ var PDFFindController = function PDFFindControllerClosure() {
         this.updateUIResultsCount();
       }
     },
-    extractText: function PDFFindController_extractText() {
+    extractText: function extractText() {
+      var _this2 = this;
+
       if (this.startedTextExtraction) {
         return;
       }
       this.startedTextExtraction = true;
-      this.pageContents = [];
-      var extractTextPromisesResolves = [];
-      var numPages = this.pdfViewer.pagesCount;
-      for (var i = 0; i < numPages; i++) {
-        this.extractTextPromises.push(new Promise(function (resolve) {
-          extractTextPromisesResolves.push(resolve);
-        }));
-      }
-      var self = this;
-      function extractPageText(pageIndex) {
-        self.pdfViewer.getPageTextContent(pageIndex).then(function textContentResolved(textContent) {
-          var textItems = textContent.items;
-          var str = [];
-          for (var i = 0, len = textItems.length; i < len; i++) {
-            str.push(textItems[i].str);
-          }
-          self.pageContents.push(str.join(''));
-          extractTextPromisesResolves[pageIndex](pageIndex);
-          if (pageIndex + 1 < self.pdfViewer.pagesCount) {
-            extractPageText(pageIndex + 1);
-          }
+      this.pageContents.length = 0;
+      var promise = Promise.resolve();
+
+      var _loop = function _loop(i, ii) {
+        var extractTextCapability = (0, _pdfjs.createPromiseCapability)();
+        _this2.extractTextPromises[i] = extractTextCapability.promise;
+        promise = promise.then(function () {
+          return _this2.pdfViewer.getPageTextContent(i).then(function (textContent) {
+            var textItems = textContent.items;
+            var strBuf = [];
+            for (var j = 0, jj = textItems.length; j < jj; j++) {
+              strBuf.push(textItems[j].str);
+            }
+            _this2.pageContents[i] = strBuf.join('');
+            extractTextCapability.resolve(i);
+          });
         });
+      };
+
+      for (var i = 0, ii = this.pdfViewer.pagesCount; i < ii; i++) {
+        _loop(i, ii);
       }
-      extractPageText(0);
     },
+
     executeCommand: function PDFFindController_executeCommand(cmd, state) {
-      var _this2 = this;
+      var _this3 = this;
 
       if (this.state === null || cmd !== 'findagain') {
         this.dirtyMatch = true;
@@ -228,12 +231,12 @@ var PDFFindController = function PDFFindControllerClosure() {
       this.state = state;
       this.updateUIState(FindStates.FIND_PENDING);
       this._firstPagePromise.then(function () {
-        _this2.extractText();
-        clearTimeout(_this2.findTimeout);
+        _this3.extractText();
+        clearTimeout(_this3.findTimeout);
         if (cmd === 'find') {
-          _this2.findTimeout = setTimeout(_this2.nextMatch.bind(_this2), 250);
+          _this3.findTimeout = setTimeout(_this3.nextMatch.bind(_this3), 250);
         } else {
-          _this2.nextMatch();
+          _this3.nextMatch();
         }
       });
     },
@@ -247,6 +250,8 @@ var PDFFindController = function PDFFindControllerClosure() {
       }
     },
     nextMatch: function PDFFindController_nextMatch() {
+      var _this4 = this;
+
       var previous = this.state.findPrevious;
       var currentPageIndex = this.pdfViewer.currentPageNumber - 1;
       var numPages = this.pdfViewer.pagesCount;
@@ -261,14 +266,13 @@ var PDFFindController = function PDFFindControllerClosure() {
         this.pageMatches = [];
         this.matchCount = 0;
         this.pageMatchesLength = null;
-        var self = this;
         for (var i = 0; i < numPages; i++) {
           this.updatePage(i);
           if (!(i in this.pendingFindMatches)) {
             this.pendingFindMatches[i] = true;
             this.extractTextPromises[i].then(function (pageIdx) {
-              delete self.pendingFindMatches[pageIdx];
-              self.calcFindMatch(pageIdx);
+              delete _this4.pendingFindMatches[pageIdx];
+              _this4.calcFindMatch(pageIdx);
             });
           }
         }

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "pdfjs-dist",
-  "version": "1.8.339",
+  "version": "1.8.342",
   "main": "build/pdf.js",
   "description": "Generic build of Mozilla's PDF.js library.",
   "keywords": [

+ 35 - 31
web/pdf_viewer.js

@@ -2097,6 +2097,8 @@ Object.defineProperty(exports, "__esModule", {
 });
 exports.PDFFindController = exports.FindStates = undefined;
 
+var _pdfjs = __w_pdfjs_require__(0);
+
 var _ui_utils = __w_pdfjs_require__(1);
 
 var FindStates = {
@@ -2267,38 +2269,39 @@ var PDFFindController = function PDFFindControllerClosure() {
         this.updateUIResultsCount();
       }
     },
-    extractText: function PDFFindController_extractText() {
+    extractText: function extractText() {
+      var _this2 = this;
+
       if (this.startedTextExtraction) {
         return;
       }
       this.startedTextExtraction = true;
-      this.pageContents = [];
-      var extractTextPromisesResolves = [];
-      var numPages = this.pdfViewer.pagesCount;
-      for (var i = 0; i < numPages; i++) {
-        this.extractTextPromises.push(new Promise(function (resolve) {
-          extractTextPromisesResolves.push(resolve);
-        }));
-      }
-      var self = this;
-      function extractPageText(pageIndex) {
-        self.pdfViewer.getPageTextContent(pageIndex).then(function textContentResolved(textContent) {
-          var textItems = textContent.items;
-          var str = [];
-          for (var i = 0, len = textItems.length; i < len; i++) {
-            str.push(textItems[i].str);
-          }
-          self.pageContents.push(str.join(''));
-          extractTextPromisesResolves[pageIndex](pageIndex);
-          if (pageIndex + 1 < self.pdfViewer.pagesCount) {
-            extractPageText(pageIndex + 1);
-          }
+      this.pageContents.length = 0;
+      var promise = Promise.resolve();
+
+      var _loop = function _loop(i, ii) {
+        var extractTextCapability = (0, _pdfjs.createPromiseCapability)();
+        _this2.extractTextPromises[i] = extractTextCapability.promise;
+        promise = promise.then(function () {
+          return _this2.pdfViewer.getPageTextContent(i).then(function (textContent) {
+            var textItems = textContent.items;
+            var strBuf = [];
+            for (var j = 0, jj = textItems.length; j < jj; j++) {
+              strBuf.push(textItems[j].str);
+            }
+            _this2.pageContents[i] = strBuf.join('');
+            extractTextCapability.resolve(i);
+          });
         });
+      };
+
+      for (var i = 0, ii = this.pdfViewer.pagesCount; i < ii; i++) {
+        _loop(i, ii);
       }
-      extractPageText(0);
     },
+
     executeCommand: function PDFFindController_executeCommand(cmd, state) {
-      var _this2 = this;
+      var _this3 = this;
 
       if (this.state === null || cmd !== 'findagain') {
         this.dirtyMatch = true;
@@ -2306,12 +2309,12 @@ var PDFFindController = function PDFFindControllerClosure() {
       this.state = state;
       this.updateUIState(FindStates.FIND_PENDING);
       this._firstPagePromise.then(function () {
-        _this2.extractText();
-        clearTimeout(_this2.findTimeout);
+        _this3.extractText();
+        clearTimeout(_this3.findTimeout);
         if (cmd === 'find') {
-          _this2.findTimeout = setTimeout(_this2.nextMatch.bind(_this2), 250);
+          _this3.findTimeout = setTimeout(_this3.nextMatch.bind(_this3), 250);
         } else {
-          _this2.nextMatch();
+          _this3.nextMatch();
         }
       });
     },
@@ -2325,6 +2328,8 @@ var PDFFindController = function PDFFindControllerClosure() {
       }
     },
     nextMatch: function PDFFindController_nextMatch() {
+      var _this4 = this;
+
       var previous = this.state.findPrevious;
       var currentPageIndex = this.pdfViewer.currentPageNumber - 1;
       var numPages = this.pdfViewer.pagesCount;
@@ -2339,14 +2344,13 @@ var PDFFindController = function PDFFindControllerClosure() {
         this.pageMatches = [];
         this.matchCount = 0;
         this.pageMatchesLength = null;
-        var self = this;
         for (var i = 0; i < numPages; i++) {
           this.updatePage(i);
           if (!(i in this.pendingFindMatches)) {
             this.pendingFindMatches[i] = true;
             this.extractTextPromises[i].then(function (pageIdx) {
-              delete self.pendingFindMatches[pageIdx];
-              self.calcFindMatch(pageIdx);
+              delete _this4.pendingFindMatches[pageIdx];
+              _this4.calcFindMatch(pageIdx);
             });
           }
         }

File diff suppressed because it is too large
+ 0 - 0
web/pdf_viewer.js.map


Some files were not shown because too many files changed in this diff