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.

if (typeof DOMMatrix !== "undefined") {
    return new DOMMatrix(matrix);
  }
  if (!svgElement) {
    const svgFactory = new DOMSVGFactory();
    svgElement = svgFactory.createElement("svg");
  }
  return svgElement.createSVGMatrix(matrix);
}
function applyBoundingBox(ctx, bbox) {
  if (!bbox || typeof Path2D === "undefined") {
    return;
  }
  const width = bbox[2] - bbox[0];
  const height = bbox[3] - bbox[1];
  const region = new Path2D();
  region.rect(bbox[0], bbox[1], width, height);
  ctx.clip(region);
}
class BaseShadingPattern {