]> git.parisson.com Git - pdf.js.git/commitdiff
Modifying how the artofwar encryption handled; add wdsg_fitc as reftest
authornotmasteryet <async.processingjs@yahoo.com>
Sat, 17 Sep 2011 15:32:42 +0000 (10:32 -0500)
committernotmasteryet <async.processingjs@yahoo.com>
Sat, 17 Sep 2011 15:32:42 +0000 (10:32 -0500)
pdf.js
test/pdfs/wdsg_fitc.pdf.link [new file with mode: 0644]
test/test_manifest.json

diff --git a/pdf.js b/pdf.js
index 599e50af8dcb084089ecccc58e40c9aab3faac7a..6a79cdf21e835095ebda6c524436dd27e7d51c37 100644 (file)
--- 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 (file)
index 0000000..77d3b59
--- /dev/null
@@ -0,0 +1 @@
+http://www.airgid.com/book/wdsg_fitc.pdf
index 3734ee9e4c33ccb5005ecdc3e87fe25b0b56977a..926e37c187b5d0786a4c13d006cd6c2c6a9e6dc5 100644 (file)
        "link": true,
        "rounds": 1,
        "type": "eq"
+    },
+    {  "id": "wdsg_fitc",
+       "file": "pdfs/wdsg_fitc.pdf",
+       "link": true,
+       "rounds": 1,
+       "type": "eq"
     }
 ]