aboutsummaryrefslogtreecommitdiffstats
path: root/src/shared/download-pdf.ts
blob: a034e44a682c1c1fb9b35cf09555a7b8eb538982 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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();
};