处理html2canvas下载图片打印不清晰问题

415 阅读1分钟
html2canvas(document.getElementById("id"),{scale:2}).then((canvas) => {
                let Url = canvas.toDataURL()
                let dom = document.createElement('a')
                dom.setAttribute("href", Url)
                dom.setAttribute("download", `${'图片名字'}.png`)
                dom.click()
  });
  • 1 html2canvas(element,options,)两个入参一个是element转换的dom一个是options参数配置 options里面有一个缩放属性scale默认为1可以按照需要自行设置 html2canvas.hertzen.com/configurati…官网链接