Skip to content

Commit 48fa017

Browse files
committed
Support corrupted pdfs that are encrypted but lack 'ID' in trailer
1 parent 2ccad4c commit 48fa017

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/obj.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,9 @@ var XRef = (function XRefClosure() {
342342

343343
var encrypt = trailerDict.get('Encrypt');
344344
if (encrypt) {
345-
var fileId = trailerDict.get('ID');
346-
this.encrypt = new CipherTransformFactory(encrypt, fileId[0], password);
345+
var ids = trailerDict.get('ID');
346+
var fileId = (ids && ids.length) ? ids[0] : '';
347+
this.encrypt = new CipherTransformFactory(encrypt, fileId, password);
347348
}
348349

349350
// get the root dictionary (catalog) object

0 commit comments

Comments
 (0)