Fix loading of PDF files with invalid or missing Type3 characters (issue 5039)
This commit is contained in:
parent
bd1c7be0cb
commit
2485f11829
@ -1760,14 +1760,17 @@ var TranslatedFont = (function TranslatedFontClosure() {
|
|||||||
var glyphStream = charProcs[key];
|
var glyphStream = charProcs[key];
|
||||||
var operatorList = new OperatorList();
|
var operatorList = new OperatorList();
|
||||||
return evaluator.getOperatorList(glyphStream, fontResources,
|
return evaluator.getOperatorList(glyphStream, fontResources,
|
||||||
operatorList).
|
operatorList).then(function () {
|
||||||
then(function () {
|
charProcOperatorList[key] = operatorList.getIR();
|
||||||
charProcOperatorList[key] = operatorList.getIR();
|
|
||||||
|
|
||||||
// Add the dependencies to the parent operator list so they are
|
// Add the dependencies to the parent operator list so they are
|
||||||
// resolved before sub operator list is executed synchronously.
|
// resolved before sub operator list is executed synchronously.
|
||||||
parentOperatorList.addDependencies(operatorList.dependencies);
|
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]));
|
}.bind(this, charProcKeys[i]));
|
||||||
}
|
}
|
||||||
this.type3Loaded = loadCharProcsPromise.then(function () {
|
this.type3Loaded = loadCharProcsPromise.then(function () {
|
||||||
|
@ -1489,11 +1489,16 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var operatorList = font.charProcOperatorList[glyph.operatorListId];
|
||||||
|
if (!operatorList) {
|
||||||
|
warn('Type3 character \"' + glyph.operatorListId +
|
||||||
|
'\" is not available');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
this.processingType3 = glyph;
|
this.processingType3 = glyph;
|
||||||
this.save();
|
this.save();
|
||||||
ctx.scale(fontSize, fontSize);
|
ctx.scale(fontSize, fontSize);
|
||||||
ctx.transform.apply(ctx, fontMatrix);
|
ctx.transform.apply(ctx, fontMatrix);
|
||||||
var operatorList = font.charProcOperatorList[glyph.operatorListId];
|
|
||||||
this.executeOperatorList(operatorList);
|
this.executeOperatorList(operatorList);
|
||||||
this.restore();
|
this.restore();
|
||||||
|
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -52,6 +52,7 @@
|
|||||||
!issue1002.pdf
|
!issue1002.pdf
|
||||||
!issue925.pdf
|
!issue925.pdf
|
||||||
!issue4668.pdf
|
!issue4668.pdf
|
||||||
|
!issue5039.pdf
|
||||||
!gradientfill.pdf
|
!gradientfill.pdf
|
||||||
!bug903856.pdf
|
!bug903856.pdf
|
||||||
!bug850854.pdf
|
!bug850854.pdf
|
||||||
|
BIN
test/pdfs/issue5039.pdf
Normal file
BIN
test/pdfs/issue5039.pdf
Normal file
Binary file not shown.
@ -1024,6 +1024,13 @@
|
|||||||
"link": true,
|
"link": true,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue5039",
|
||||||
|
"file": "pdfs/issue5039.pdf",
|
||||||
|
"md5": "5c131f458ee6b65cc096ccaf0474ee3a",
|
||||||
|
"link": false,
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "issue1257",
|
{ "id": "issue1257",
|
||||||
"file": "pdfs/issue1257.pdf",
|
"file": "pdfs/issue1257.pdf",
|
||||||
"md5": "9111533826bc21ed774e8e01603a2f54",
|
"md5": "9111533826bc21ed774e8e01603a2f54",
|
||||||
|
Loading…
Reference in New Issue
Block a user