]> git.parisson.com Git - pdf.js.git/commitdiff
Recovering from RGBT-command (ref #577)
authornotmasteryet <async.processingjs@yahoo.com>
Sun, 2 Oct 2011 00:01:58 +0000 (19:01 -0500)
committernotmasteryet <async.processingjs@yahoo.com>
Sun, 2 Oct 2011 00:01:58 +0000 (19:01 -0500)
pdf.js
test/pdfs/vesta.pdf.link [new file with mode: 0644]
test/test_manifest.json

diff --git a/pdf.js b/pdf.js
index 3fa22496af0cffdce7cc0377801c774fa7ac7d74..cd643e760746e77f84d71add17d4993f3112f319 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -4366,6 +4366,20 @@ var PartialEvaluator = (function partialEvaluator() {
         if (isCmd(obj)) {
           var cmd = obj.cmd;
           var fn = OP_MAP[cmd];
+          if (!fn) {
+            // invalid content command, trying to recover
+            if (cmd.substr(-2) == 'BT') {
+              fn = OP_MAP[cmd.substr(0, cmd.length - 2)];
+              // feeding 'BT' on next interation
+              parser = {
+                getObj: function() {
+                  parser = this.oldParser;
+                  return { name: 'BT' };
+                },
+                oldParser: parser
+              };
+            }
+          }
           assertWellFormed(fn, "Unknown command '" + cmd + "'");
           // TODO figure out how to type-check vararg functions
 
diff --git a/test/pdfs/vesta.pdf.link b/test/pdfs/vesta.pdf.link
new file mode 100644 (file)
index 0000000..7aa348d
--- /dev/null
@@ -0,0 +1 @@
+http://www-csag.ucsd.edu/~jburke/Vesta/Vesta_Overview.pdf
index 71738f1924e18e500be9712043dfc2ebd8e35d72..51428190d9cd4888df48a923cd3b8800598443fa 100644 (file)
        "rounds": 1,
        "type": "load"
     },
+    {  "id": "vesta-bad",
+       "file": "pdfs/vesta.pdf",
+       "link": true,
+       "rounds": 1,
+       "type": "load"
+    },
     {  "id": "ibwa-bad",
        "file": "pdfs/ibwa-bad.pdf",
        "link": true,