add jspdf, could be useful in the future
This commit is contained in:
parent
930d639da4
commit
2846ca694c
1 changed files with 23 additions and 0 deletions
23
templates/libs/jspdf_footer.html
Normal file
23
templates/libs/jspdf_footer.html
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<script src="//html2canvas.hertzen.com/dist/html2canvas.min.js"></script>
|
||||||
|
<script
|
||||||
|
src="//cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"
|
||||||
|
integrity="sha512-qZvrmS2ekKPF2mSznTQsxqPgnpkI4DNTlrdUmTzrDgektczlKNRRhy5X5AAOnx5S09ydFYWWNSfcEqDTTHgtNA=="
|
||||||
|
crossorigin="anonymous"
|
||||||
|
referrerpolicy="no-referrer"
|
||||||
|
></script>
|
||||||
|
<script>
|
||||||
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
|
const { jsPDF } = window.jspdf;
|
||||||
|
|
||||||
|
const doc = new jsPDF();
|
||||||
|
|
||||||
|
doc.html(document.body, {
|
||||||
|
width: doc.internal.pageSize.getWidth() - 20,
|
||||||
|
windowWidth: 800,
|
||||||
|
margin: [15, 10, 10, 10],
|
||||||
|
callback: function (doc) {
|
||||||
|
doc.save(`${document.title}.pdf`);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Reference in a new issue