diff --git a/src/core.js b/src/core.js index 4cc5984e2..765a239b7 100644 --- a/src/core.js +++ b/src/core.js @@ -539,13 +539,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; 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 684f7aa2d..7954aa094 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -382,6 +382,13 @@ "rounds": 1, "type": "eq" }, + { "id": "ocs", + "file": "pdfs/ocs.pdf", + "md5": "2ade57e954ae7632749cf328daeaa7a8", + "rounds": 1, + "link": true, + "type": "load" + }, { "id": "issue1015", "file": "pdfs/issue1015.pdf", "md5": "b61503d1b445742b665212866afb60e2",