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.

const currentTransform = currentCtx.mozCurrentTransform;
      if (group.matrix) {
        currentCtx.transform.apply(currentCtx, group.matrix);
      }
      if (!group.bbox) {
        throw new Error("Bounding box is required.");
      }
      
      
      let bounds = Util.getAxialAlignedBoundingBox(
        group.bbox,
        currentCtx.mozCurrentTransform
      );
      
      const canvasBounds = [
        0,
        0,
        currentCtx.canvas.width,
        currentCtx.canvas.height,
      ];
      bounds = Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0];
      
      
      const offsetX = Math.floor(bounds[0]);
      const offsetY = Math.floor(bounds[1]);
      let drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1);
      let drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1);
      let scaleX = 1,
        scaleY = 1;
      if (drawnWidth > MAX_GROUP_SIZE) {