Merge pull request #1022 from notmasteryet/tree-53

Fixes this.xref.trailer.get("ID")[0] is undefined
This commit is contained in:
Artur Adib 2012-01-05 07:44:52 -08:00
commit 0817c4274d
3 changed files with 16 additions and 6 deletions

View File

@ -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;

1
test/pdfs/ocs.pdf.link Normal file
View File

@ -0,0 +1 @@
http://www.unibuc.ro/uploads_en/29535/10/Cyrillic_Alphabets-Chars.pdf

View File

@ -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",