PDF.js displays blurry plots in PDF documents, e.g.

http://arxiv.org/pdf/1202.5344v1.pdf

When viewed in Chrome or Adobe Acrobat all the plots show sharp-edged squares. When viewed in Preview or PDF.js, all the squares show as blurry pixelated blobs.

tmpCtx.clearRect(0, 0, newWidth, newHeight);
        tmpCtx.drawImage(
          imgToPaint,
          0,
          0,
          paintWidth,
          paintHeight,
          0,
          0,
          newWidth,
          newHeight
        );
        imgToPaint = tmpCanvas.canvas;
        paintWidth = newWidth;
        paintHeight = newHeight;
        tmpCanvasId = tmpCanvasId === "prescale1" ? "prescale2" : "prescale1";
      }
      ctx.drawImage(
        imgToPaint,
        0,
        0,
        paintWidth,
        paintHeight,
        0,
        -height,
        width,
        height
      );
      if (this.imageLayer) {
        const position = this.getCanvasPosition(0, -height);