This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import html2canvas from "html2canvas"; | |
import jsPDF from "jspdf"; | |
const exportPDF = () => { | |
const input = document.getElementById("documentID") as HTMLElement; | |
html2canvas(input, { logging: true, useCORS: true }).then((canvas) => { | |
const imgWidth = 290; | |
const imgHeight = 210; | |
const imgData = canvas.toDataURL("img/png"); transform canvas to an image | |
const pdf = new jsPDF("l", "mm", "a4"); // L is landscape, you can use whatever you want for example p to make it portrait |