From d26988f5bbd147ef230676446e687eb527a7d7ad Mon Sep 17 00:00:00 2001 From: Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> Date: Thu, 6 Apr 2023 08:56:56 +0530 Subject: Added "Download PDF" button to khatian information. --- src/shared/download-pdf.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/shared/download-pdf.ts (limited to 'src/shared') diff --git a/src/shared/download-pdf.ts b/src/shared/download-pdf.ts new file mode 100644 index 0000000..a034e44 --- /dev/null +++ b/src/shared/download-pdf.ts @@ -0,0 +1,22 @@ +import html2pdf from "html2pdf.js"; + +export const downloadPDF = (element: HTMLElement, filename: string = "banglarbhumi.pdf") => { + html2pdf().set({ + margin: 0, + filename: filename, + image: { + type: "jpeg", + quality: 0.98 + }, + html2canvas: { + scale: 1 + }, + jsPDF: { + unit: "in", + format: "letter", + orientation: "portrait" + } + }) + .from(element) + .save(); +}; -- cgit v1.2.3