Adds additional parameter so background color of canvas can be set

This commit is contained in:
chris.greening 2017-05-16 12:01:03 +01:00
parent 08f8b68f12
commit cfc2f36f5c
8 changed files with 429 additions and 27 deletions

View file

@ -705,8 +705,8 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
CanvasGraphics.prototype = {
beginDrawing: function CanvasGraphics_beginDrawing(transform, viewport,
transparency) {
beginDrawing({ transform, viewport, transparency,
background = null, }) {
// For pdfs that use blend modes we have to clear the canvas else certain
// blend modes can look wrong since we'd be blending with a white
// backdrop. The problem with a transparent backdrop though is we then
@ -716,7 +716,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
var height = this.ctx.canvas.height;
this.ctx.save();
this.ctx.fillStyle = 'rgb(255, 255, 255)';
this.ctx.fillStyle = background || 'rgb(255, 255, 255)';
this.ctx.fillRect(0, 0, width, height);
this.ctx.restore();