From 1fa5e80ebef7b5f37586083e25978310d6db129d Mon Sep 17 00:00:00 2001 From: notmasteryet Date: Tue, 3 Jan 2012 19:20:29 -0600 Subject: [PATCH] Fixes this.xref.trailer.get("ID")[0] is undefined --- src/core.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/core.js b/src/core.js index 8b5fbea75..8a96df3c8 100644 --- a/src/core.js +++ b/src/core.js @@ -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;