Skip to content

Commit

Permalink
Support corrupted pdfs that are encrypted but lack 'ID' in trailer
Browse files Browse the repository at this point in the history
  • Loading branch information
mduan committed Jan 14, 2013
1 parent 2ccad4c commit 48fa017
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/obj.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,9 @@ var XRef = (function XRefClosure() {

var encrypt = trailerDict.get('Encrypt');
if (encrypt) {
var fileId = trailerDict.get('ID');
this.encrypt = new CipherTransformFactory(encrypt, fileId[0], password);
var ids = trailerDict.get('ID');
var fileId = (ids && ids.length) ? ids[0] : '';
this.encrypt = new CipherTransformFactory(encrypt, fileId, password);
}

// get the root dictionary (catalog) object
Expand Down

0 comments on commit 48fa017

Please sign in to comment.