Browse Source

PDF.js version 1.0.224

Yury Delendik 10 years ago
parent
commit
61e467a969
5 changed files with 50 additions and 12 deletions
  1. 1 1
      bower.json
  2. 23 4
      build/pdf.combined.js
  3. 2 2
      build/pdf.js
  4. 23 4
      build/pdf.worker.js
  5. 1 1
      package.json

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "pdfjs-dist",
   "name": "pdfjs-dist",
-  "version": "1.0.221",
+  "version": "1.0.224",
   "keywords": [
   "keywords": [
     "Mozilla",
     "Mozilla",
     "pdf",
     "pdf",

+ 23 - 4
build/pdf.combined.js

@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 }
 
 
-PDFJS.version = '1.0.221';
-PDFJS.build = 'b7d8296';
+PDFJS.version = '1.0.224';
+PDFJS.build = '5cd6483';
 
 
 (function pdfjsWrapper() {
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it
   // Use strict in our context only - users might not want it
@@ -8902,6 +8902,10 @@ var ChunkedStream = (function ChunkedStreamClosure() {
       return this.end - this.start;
       return this.end - this.start;
     },
     },
 
 
+    get isEmpty() {
+      return this.length === 0;
+    },
+
     getByte: function ChunkedStream_getByte() {
     getByte: function ChunkedStream_getByte() {
       var pos = this.pos;
       var pos = this.pos;
       if (pos >= this.end) {
       if (pos >= this.end) {
@@ -25332,7 +25336,13 @@ var Font = (function FontClosure() {
       this.defaultVMetrics = properties.defaultVMetrics;
       this.defaultVMetrics = properties.defaultVMetrics;
     }
     }
 
 
-    if (!file) {
+    if (!file || file.isEmpty) {
+      if (file) {
+        // Some bad PDF generators will include empty font files,
+        // attempting to recover by assuming that no file exists.
+        warn('Font file is empty in "' + name + '" (' + this.loadedName + ')');
+      }
+
       this.missingFile = true;
       this.missingFile = true;
       // The file data is not specified. Trying to fix the font name
       // The file data is not specified. Trying to fix the font name
       // to be used with the canvas.font.
       // to be used with the canvas.font.
@@ -39647,6 +39657,9 @@ var Stream = (function StreamClosure() {
     get length() {
     get length() {
       return this.end - this.start;
       return this.end - this.start;
     },
     },
+    get isEmpty() {
+      return this.length === 0;
+    },
     getByte: function Stream_getByte() {
     getByte: function Stream_getByte() {
       if (this.pos >= this.end) {
       if (this.pos >= this.end) {
         return -1;
         return -1;
@@ -39740,6 +39753,12 @@ var DecodeStream = (function DecodeStreamClosure() {
   }
   }
 
 
   DecodeStream.prototype = {
   DecodeStream.prototype = {
+    get isEmpty() {
+      while (!this.eof && this.bufferLength === 0) {
+        this.readBlock();
+      }
+      return this.bufferLength === 0;
+    },
     ensureBuffer: function DecodeStream_ensureBuffer(requested) {
     ensureBuffer: function DecodeStream_ensureBuffer(requested) {
       var buffer = this.buffer;
       var buffer = this.buffer;
       var current;
       var current;
@@ -39825,7 +39844,7 @@ var DecodeStream = (function DecodeStreamClosure() {
       }
       }
       return new Stream(this.buffer, start, length, dict);
       return new Stream(this.buffer, start, length, dict);
     },
     },
-    skip: function Stream_skip(n) {
+    skip: function DecodeStream_skip(n) {
       if (!n) {
       if (!n) {
         n = 1;
         n = 1;
       }
       }

+ 2 - 2
build/pdf.js

@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 }
 
 
-PDFJS.version = '1.0.221';
-PDFJS.build = 'b7d8296';
+PDFJS.version = '1.0.224';
+PDFJS.build = '5cd6483';
 
 
 (function pdfjsWrapper() {
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it
   // Use strict in our context only - users might not want it

+ 23 - 4
build/pdf.worker.js

@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 }
 
 
-PDFJS.version = '1.0.221';
-PDFJS.build = 'b7d8296';
+PDFJS.version = '1.0.224';
+PDFJS.build = '5cd6483';
 
 
 (function pdfjsWrapper() {
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it
   // Use strict in our context only - users might not want it
@@ -4309,6 +4309,10 @@ var ChunkedStream = (function ChunkedStreamClosure() {
       return this.end - this.start;
       return this.end - this.start;
     },
     },
 
 
+    get isEmpty() {
+      return this.length === 0;
+    },
+
     getByte: function ChunkedStream_getByte() {
     getByte: function ChunkedStream_getByte() {
       var pos = this.pos;
       var pos = this.pos;
       if (pos >= this.end) {
       if (pos >= this.end) {
@@ -20739,7 +20743,13 @@ var Font = (function FontClosure() {
       this.defaultVMetrics = properties.defaultVMetrics;
       this.defaultVMetrics = properties.defaultVMetrics;
     }
     }
 
 
-    if (!file) {
+    if (!file || file.isEmpty) {
+      if (file) {
+        // Some bad PDF generators will include empty font files,
+        // attempting to recover by assuming that no file exists.
+        warn('Font file is empty in "' + name + '" (' + this.loadedName + ')');
+      }
+
       this.missingFile = true;
       this.missingFile = true;
       // The file data is not specified. Trying to fix the font name
       // The file data is not specified. Trying to fix the font name
       // to be used with the canvas.font.
       // to be used with the canvas.font.
@@ -35054,6 +35064,9 @@ var Stream = (function StreamClosure() {
     get length() {
     get length() {
       return this.end - this.start;
       return this.end - this.start;
     },
     },
+    get isEmpty() {
+      return this.length === 0;
+    },
     getByte: function Stream_getByte() {
     getByte: function Stream_getByte() {
       if (this.pos >= this.end) {
       if (this.pos >= this.end) {
         return -1;
         return -1;
@@ -35147,6 +35160,12 @@ var DecodeStream = (function DecodeStreamClosure() {
   }
   }
 
 
   DecodeStream.prototype = {
   DecodeStream.prototype = {
+    get isEmpty() {
+      while (!this.eof && this.bufferLength === 0) {
+        this.readBlock();
+      }
+      return this.bufferLength === 0;
+    },
     ensureBuffer: function DecodeStream_ensureBuffer(requested) {
     ensureBuffer: function DecodeStream_ensureBuffer(requested) {
       var buffer = this.buffer;
       var buffer = this.buffer;
       var current;
       var current;
@@ -35232,7 +35251,7 @@ var DecodeStream = (function DecodeStreamClosure() {
       }
       }
       return new Stream(this.buffer, start, length, dict);
       return new Stream(this.buffer, start, length, dict);
     },
     },
-    skip: function Stream_skip(n) {
+    skip: function DecodeStream_skip(n) {
       if (!n) {
       if (!n) {
         n = 1;
         n = 1;
       }
       }

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "pdfjs-dist",
   "name": "pdfjs-dist",
-  "version": "1.0.221",
+  "version": "1.0.224",
   "description": "Generic build of Mozilla's PDF.js library.",
   "description": "Generic build of Mozilla's PDF.js library.",
   "keywords": [
   "keywords": [
     "Mozilla",
     "Mozilla",