From: notmasteryet Date: Sat, 17 Sep 2011 15:32:42 +0000 (-0500) Subject: Modifying how the artofwar encryption handled; add wdsg_fitc as reftest X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=1d00b89285e44d55c1bedcf0fcc5df941e463b81;p=pdf.js.git Modifying how the artofwar encryption handled; add wdsg_fitc as reftest --- diff --git a/pdf.js b/pdf.js index 599e50a..6a79cdf 100644 --- a/pdf.js +++ b/pdf.js @@ -3224,7 +3224,14 @@ var XRef = (function() { error('bad XRef entry'); } if (this.encrypt && !suppressEncryption) { - e = parser.getObj(this.encrypt.createCipherTransform(num, gen)); + try { + e = parser.getObj(this.encrypt.createCipherTransform(num, gen)); + } catch(ex) { + // almost all streams must to encrypted, but sometimes + // they are not probably due to some broken generators + // re-trying without encryption + return this.fetch(ref, true); + } } else { e = parser.getObj(); } @@ -4381,7 +4388,7 @@ var PartialEvaluator = (function() { if (type == 'TrueType' && dict.has('ToUnicode') && differences) { var cmapObj = dict.get('ToUnicode'); if (IsRef(cmapObj)) { - cmapObj = xref.fetch(cmapObj, true); + cmapObj = xref.fetch(cmapObj); } if (IsName(cmapObj)) { error('ToUnicode file cmap translation not implemented'); diff --git a/test/pdfs/wdsg_fitc.pdf.link b/test/pdfs/wdsg_fitc.pdf.link new file mode 100644 index 0000000..77d3b59 --- /dev/null +++ b/test/pdfs/wdsg_fitc.pdf.link @@ -0,0 +1 @@ +http://www.airgid.com/book/wdsg_fitc.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index 3734ee9..926e37c 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -115,5 +115,11 @@ "link": true, "rounds": 1, "type": "eq" + }, + { "id": "wdsg_fitc", + "file": "pdfs/wdsg_fitc.pdf", + "link": true, + "rounds": 1, + "type": "eq" } ]