34 lines
994 B
TypeScript
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,
|
|
});
|
|
}
|