]> git.parisson.com Git - pdf.js.git/commitdiff
Fixes this.xref.trailer.get("ID")[0] is undefined
authornotmasteryet <async.processingjs@yahoo.com>
Wed, 4 Jan 2012 01:20:29 +0000 (19:20 -0600)
committernotmasteryet <async.processingjs@yahoo.com>
Wed, 4 Jan 2012 01:20:29 +0000 (19:20 -0600)
src/core.js

index 8b5fbea753a9d7104a58de89a3d4178e79fd7c35..8a96df3c8d91ea34237f75cf1b82f7fc2263cf58 100644 (file)
@@ -531,13 +531,15 @@ var PDFDocModel = (function PDFDocModelClosure() {
     },
     setup: function pdfDocSetup(ownerPassword, userPassword) {
       this.checkHeader();
-      this.xref = new XRef(this.stream,
-                           this.startXRef,
-                           this.mainXRefEntriesOffset);
-      this.catalog = new Catalog(this.xref);
-      if (this.xref.trailer && this.xref.trailer.has('ID')) {
+      var xref = new XRef(this.stream,
+                          this.startXRef,
+                          this.mainXRefEntriesOffset);
+      this.xref = xref;
+      this.catalog = new Catalog(xref);
+      if (xref.trailer && xref.trailer.has('ID')) {
         var fileID = '';
-        this.xref.trailer.get('ID')[0].split('').forEach(function(el) {
+        var id = xref.fetchIfRef(xref.trailer.get('ID'))[0];
+        id.split('').forEach(function(el) {
           fileID += Number(el.charCodeAt(0)).toString(16);
         });
         this.fileID = fileID;