有没有办法用画布创建质量更好的图像?

时间:2018-08-01 06:52:33

标签: canvas jspdf

我正在创建图像并将其保存为pdf:

printDocument: props => () => {
  const input = document.getElementById(`${props.id}`);
  const pdf = new jsPDF({
    orientation: "p",
    unit: "mm",
    format: "a4"
  });
  html2canvas(input).then(canvas => {
    const fullQuality = canvas.toDataURL("image/jpeg", 1.0);
    pdf.addImage(fullQuality, 0, 0);
    pdf.save("download.pdf");
  });
}

根据文档- reference

const fullQuality = canvas.toDataURL("image/jpeg", 1.0)

这是高质量的图像,但是在pdf中,我实际上可以看到像素

0 个答案:

没有答案