【发布时间】:2019-04-18 03:20:12
【问题描述】:
我正在使用 html2canvas.js 从 html 和 jspdf.js 制作屏幕截图来制作 pdf。 我的 html 如下所示
<div id="panel-item-all-annotations">
<div class="panel-body" id="" style="width: 100%;">
{{--some html with image--}}
</div>
</div>
<canvas width="800" height="500" style="display: block;"></canvas>
我正在使用画布通过 JS 代码放置 div#panel-item-all-annotations 的图像,如下所示
html2canvas(document.querySelector("#panel-item-all-annotations"), {canvas: canvas}).then(function(canvas) {
console.log('Drew on the existing canvas');
});
但它没有在画布上正确放置图像。它将它放置在画布的最底部和右侧,如下所示
html2canvas.js 网址:https://html2canvas.hertzen.com/ jspdf:https://github.com/MrRio/jsPDF
【问题讨论】:
标签: javascript html canvas jspdf html2canvas