Skip to content

Commit 5995198

Browse files
FlamencoMrRio
authored andcommitted
c2d plugin should reference current page when deferring a write #909 (#910)
1 parent 61976e6 commit 5995198

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

plugins/context2d.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@
288288
if (window.outIntercept) {
289289
lines = window.outIntercept.type === 'group' ? window.outIntercept.stream : window.outIntercept;
290290
} else {
291-
lines = this.pdf.internal.pages[1];
291+
lines = this.internal.getCurrentPage();
292292
}
293293
lines.push("q");
294294
var origPath = this.path;
@@ -326,7 +326,7 @@
326326
if (window.outIntercept) {
327327
lines = window.outIntercept.type === 'group' ? window.outIntercept.stream : window.outIntercept;
328328
} else {
329-
lines = this.pdf.internal.pages[1];
329+
lines = this.internal.getCurrentPage();
330330
}
331331
lines.push("q");
332332
var origPath = this.path;
@@ -831,7 +831,7 @@
831831
if (window.outIntercept) {
832832
lines = window.outIntercept.type === 'group' ? window.outIntercept.stream : window.outIntercept;
833833
} else {
834-
lines = this.pdf.internal.pages[1];
834+
lines = this.internal.getCurrentPage();
835835
}
836836
lines.push("q");
837837

@@ -953,7 +953,7 @@
953953
if (window.outIntercept) {
954954
lines = window.outIntercept.type === 'group' ? window.outIntercept.stream : window.outIntercept;
955955
} else {
956-
lines = this.pdf.internal.pages[1];
956+
lines = this.internal.getCurrentPage();
957957
}
958958
lines.push("q");
959959

@@ -982,7 +982,7 @@
982982
if (window.outIntercept) {
983983
lines = window.outIntercept.type === 'group' ? window.outIntercept.stream : window.outIntercept;
984984
} else {
985-
lines = this.pdf.internal.pages[1];
985+
lines = this.internal.getCurrentPage();
986986
}
987987

988988
// if (this.ctx._clip_path.length > 0) {
@@ -1518,6 +1518,10 @@
15181518
return curves;
15191519
};
15201520

1521+
c2d.internal.getCurrentPage = function () {
1522+
return this.pdf.internal.pages[this.pdf.internal.getCurrentPageInfo().pageNumber];
1523+
};
1524+
15211525
/**
15221526
* Cubic bezier approximation of a circular arc centered at the origin, from (radians) a1 to a2, where a2-a1 < pi/2. The arc's radius is r.
15231527
*

0 commit comments

Comments
 (0)