Fixes incomplete restore in paintFormXObject
This commit is contained in:
parent
d2c1868497
commit
4c533d065d
@ -187,6 +187,7 @@ var CanvasExtraState = (function CanvasExtraStateClosure() {
|
||||
this.fillAlpha = 1;
|
||||
this.strokeAlpha = 1;
|
||||
this.lineWidth = 1;
|
||||
this.paintFormXObjectDepth = 0;
|
||||
|
||||
this.old = old;
|
||||
}
|
||||
@ -1102,6 +1103,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
||||
paintFormXObjectBegin: function CanvasGraphics_paintFormXObjectBegin(matrix,
|
||||
bbox) {
|
||||
this.save();
|
||||
this.current.paintFormXObjectDepth++;
|
||||
|
||||
if (matrix && isArray(matrix) && 6 == matrix.length)
|
||||
this.transform.apply(this, matrix);
|
||||
@ -1116,7 +1118,12 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
||||
},
|
||||
|
||||
paintFormXObjectEnd: function CanvasGraphics_paintFormXObjectEnd() {
|
||||
var depth = this.current.paintFormXObjectDepth;
|
||||
do {
|
||||
this.restore();
|
||||
// some pdf don't close all restores inside object
|
||||
// closing those for them
|
||||
} while (this.current.paintFormXObjectDepth >= depth);
|
||||
},
|
||||
|
||||
paintJpegXObject: function CanvasGraphics_paintJpegXObject(objId, w, h) {
|
||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -24,6 +24,7 @@
|
||||
!pdfkit_compressed.pdf
|
||||
!TAMReview.pdf
|
||||
!issue918.pdf
|
||||
!issue1905.pdf
|
||||
!issue1249.pdf
|
||||
!smaskdim.pdf
|
||||
!type4psfunc.pdf
|
||||
|
BIN
test/pdfs/issue1905.pdf
Normal file
BIN
test/pdfs/issue1905.pdf
Normal file
Binary file not shown.
@ -367,6 +367,12 @@
|
||||
"pageLimit": 3,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "issue1905",
|
||||
"file": "pdfs/issue1905.pdf",
|
||||
"md5": "b1bbd72ca6522ae1502aa26320f81994",
|
||||
"rounds": 1,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "issue918",
|
||||
"file": "pdfs/issue918.pdf",
|
||||
"md5": "d582cc0f2592ae82936589ced2a47e55",
|
||||
|
Loading…
Reference in New Issue
Block a user