From 48fa0172ed88a7b02e58b57169422938338939a6 Mon Sep 17 00:00:00 2001 From: mduan Date: Tue, 8 Jan 2013 19:00:05 -0800 Subject: [PATCH] Support corrupted pdfs that are encrypted but lack 'ID' in trailer --- src/obj.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/obj.js b/src/obj.js index c2dc720d9..df09d3630 100644 --- a/src/obj.js +++ b/src/obj.js @@ -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