Files
CVAtron/resources/js/lib/pdfExport.ts
Matthias Guillitte cb242e59ba
Some checks failed
linter / quality (push) Successful in 3m37s
tests / ci (push) Failing after 13m21s
Minimal Viable Product + Refactor to pinia store + Fix PDF export
2025-09-16 16:30:37 +02:00

34 lines
994 B
TypeScript

import { jsPDF } from "jspdf";
export function exportToPdf(element: HTMLElement, name: string) {
// const pdf = new jsPDF({orientation: 'portrait', unit: 'mm', format: 'a4', precision: 1, hotfixes: ["px_scaling"]});
// pdf.html(element, {
// callback: function (doc) {
// doc.save(name);
// },
// margin: [0, 0, 0, 0],
// autoPaging: 'text',
// // width: 210,
// // windowWidth: 2100,
// html2canvas: {
// allowTaint: true,
// letterRendering: true,
// logging: true,
// // width: 210,
// // windowWidth: 2100,
// // scale: 0.2,
// // scale: 210 / element.scrollWidth,
// },
// });
const pdf = new jsPDF({ orientation: 'portrait', unit: 'mm', format: 'a4' });
pdf.html(element, {
callback: function (doc) {
doc.save(name);
},
width: 210,
windowWidth: 1080,
});
}