From 1fa5e80ebef7b5f37586083e25978310d6db129d Mon Sep 17 00:00:00 2001 From: notmasteryet Date: Tue, 3 Jan 2012 19:20:29 -0600 Subject: [PATCH 1/2] 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; From 3533e5ac6afd990e418c06b7eb7d8c6701554fdb Mon Sep 17 00:00:00 2001 From: notmasteryet Date: Wed, 4 Jan 2012 19:55:04 -0600 Subject: [PATCH 2/2] Add load test --- test/pdfs/ocs.pdf.link | 1 + test/test_manifest.json | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 test/pdfs/ocs.pdf.link diff --git a/test/pdfs/ocs.pdf.link b/test/pdfs/ocs.pdf.link new file mode 100644 index 000000000..10c2b1b9e --- /dev/null +++ b/test/pdfs/ocs.pdf.link @@ -0,0 +1 @@ +http://www.unibuc.ro/uploads_en/29535/10/Cyrillic_Alphabets-Chars.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index dbb83604b..fd2eb1e58 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -381,5 +381,12 @@ "md5": "7e6027a02ff78577f74dccdf84e37189", "rounds": 1, "type": "eq" + }, + { "id": "ocs", + "file": "pdfs/ocs.pdf", + "md5": "2ade57e954ae7632749cf328daeaa7a8", + "rounds": 1, + "link": true, + "type": "load" } ]