Level : WORDPRESS BOOK LINKEDIN PATENT Send Mail 동냥하기 hajunho.com

반응형
<html>

<body>
    <div id="test">
        <h1> Hello! Screenshot Me!</h1>
    </div>
    <button id="btn">screenshot</button>
</body>
<script src="https://unpkg.com/jspdf@latest/dist/jspdf.umd.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/html2canvas@1.0.0-rc.7/dist/html2canvas.min.js"></script>
<script>
    window.onload = function () {
        console.log("Window is loaded")
        document.getElementById('btn').addEventListener("click", function () {
            html2canvas(document.getElementById('test')).then(function (canvas) {
                document.body.appendChild(canvas);
                var imgdata = canvas.toDataURL("image/jpg");
                var doc = new jspdf.jsPDF();
                doc.addImage(imgdata, "JPG", 10, 10);
                doc.save("sample.pdf");
            });
        })

    }

</script>

</html>

from. https://stackoverflow.com/questions/65335526/html-page-screenshot-to-pdf-using-html2canvas-and-jspdf

 

html page screenshot to pdf using html2canvas and jspdf

I am trying to create a receipt or invoice to pdf by screenshot of a php page. I found a source code on youtube and tried it for myself, however, it is not saving or downloading any pdf. here is th...

stackoverflow.com

 

반응형

'OpenSRC+ChatGPT' 카테고리의 다른 글

SAMURAI  (0) 2024.11.23
simd_float4x4  (0) 2021.01.14
App Store 정보 18.Dec.2020  (0) 2020.12.18
previousPinchRecogScale  (0) 2020.12.14
pkg mng system. brew -> port  (0) 2020.11.27
  • 네이버 블러그 공유하기
  • 네이버 밴드에 공유하기
  • 페이스북 공유하기
  • 카카오스토리 공유하기