diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 2579ddfdb..279c47659 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -1760,14 +1760,17 @@ var TranslatedFont = (function TranslatedFontClosure() { var glyphStream = charProcs[key]; var operatorList = new OperatorList(); return evaluator.getOperatorList(glyphStream, fontResources, - operatorList). - then(function () { - charProcOperatorList[key] = operatorList.getIR(); + operatorList).then(function () { + charProcOperatorList[key] = operatorList.getIR(); - // Add the dependencies to the parent operator list so they are - // resolved before sub operator list is executed synchronously. - parentOperatorList.addDependencies(operatorList.dependencies); - }); + // Add the dependencies to the parent operator list so they are + // resolved before sub operator list is executed synchronously. + parentOperatorList.addDependencies(operatorList.dependencies); + }, function (reason) { + warn('Type3 font resource \"' + key + '\" is not available'); + var operatorList = new OperatorList(); + charProcOperatorList[key] = operatorList.getIR(); + }); }.bind(this, charProcKeys[i])); } this.type3Loaded = loadCharProcsPromise.then(function () { diff --git a/src/display/canvas.js b/src/display/canvas.js index fab668715..9972a8a5e 100644 --- a/src/display/canvas.js +++ b/src/display/canvas.js @@ -1489,11 +1489,16 @@ var CanvasGraphics = (function CanvasGraphicsClosure() { continue; } + var operatorList = font.charProcOperatorList[glyph.operatorListId]; + if (!operatorList) { + warn('Type3 character \"' + glyph.operatorListId + + '\" is not available'); + continue; + } this.processingType3 = glyph; this.save(); ctx.scale(fontSize, fontSize); ctx.transform.apply(ctx, fontMatrix); - var operatorList = font.charProcOperatorList[glyph.operatorListId]; this.executeOperatorList(operatorList); this.restore(); diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index ad859818d..51bc02bc8 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -52,6 +52,7 @@ !issue1002.pdf !issue925.pdf !issue4668.pdf +!issue5039.pdf !gradientfill.pdf !bug903856.pdf !bug850854.pdf diff --git a/test/pdfs/issue5039.pdf b/test/pdfs/issue5039.pdf new file mode 100644 index 000000000..dfe29fe9d Binary files /dev/null and b/test/pdfs/issue5039.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index cc2ce05b1..313a4ab4c 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -1024,6 +1024,13 @@ "link": true, "type": "eq" }, + { "id": "issue5039", + "file": "pdfs/issue5039.pdf", + "md5": "5c131f458ee6b65cc096ccaf0474ee3a", + "link": false, + "rounds": 1, + "type": "eq" + }, { "id": "issue1257", "file": "pdfs/issue1257.pdf", "md5": "9111533826bc21ed774e8e01603a2f54",