【问题标题】:Extra white space on the left and lost part on the right with html2canvashtml2canvas 左边有多余的空白,右边有丢失的部分
【发布时间】:2022-01-21 21:19:21
【问题描述】:

当我尝试通过 html2canvas 下载图像时,多余和丢失部分的宽度似乎总是 8px。

html2canvas(elementRef.nativeElement).then((canvas) => {
      let link = document.createElement("a");
      link.href = canvas.toDataURL("image/png");
      link.download = fileName;
      document.body.appendChild(link);
      link.click();
    });

【问题讨论】:

    标签: html2canvas


    【解决方案1】:

    我解决了所有可能的问题如下..

    html2canvas(element , {
            scrollX: -window.scrollX,
            scrollY: -window.scrollY,
            windowWidth: document.documentElement.offsetWidth,
            windowHeight: document.documentElement.offsetHeight
    })
    

    【讨论】:

      猜你喜欢
      • 2012-01-18
      • 1970-01-01
      • 2021-12-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-22
      • 1970-01-01
      相关资源
      最近更新 更多