This commit is contained in:
Torsten Schulz
2025-07-15 18:19:30 +02:00
parent 39089a70d3
commit eba160c43d

View File

@@ -6,7 +6,7 @@ class PDFGenerator {
this.pdf = new jsPDF('p', 'mm', 'a4');
this.margin = margin;
this.columnGap = columnGap;
this.pageHeight = 297 - margin * 2;
this.pageHeight = 297 - margin * 2;
this.columnWidth = (210 - margin * 2 - columnGap) / 2;
this.position = margin;
this.yPos = this.position;
@@ -23,17 +23,19 @@ class PDFGenerator {
const canvas = await html2canvas(element, {
scale: 2,
onclone: (clonedDoc) => {
// Klon des Wurzel-Elements
const tbl = clonedDoc.getElementById(element.id);
if (!tbl) return;
// Alle Zellen und Überschriften-Elemente auswählen
const cells = tbl.querySelectorAll('td, th');
cells.forEach(cell => {
cell.style.fontSize = '12pt';
});
const clonedEl = clonedDoc.getElementById('schedule');
if (clonedEl) clonedEl.style.fontSize = '12pt';
// Klon des Wurzel-Elements
const tbl = clonedDoc.getElementById(element.id);
if (!tbl) return;
// Alle Zellen und Überschriften-Elemente auswählen
const cells = tbl.querySelectorAll('td, th');
cells.forEach(cell => {
cell.style.fontSize = '12pt';
});
}
});
});
const imgData = canvas.toDataURL('image/png');
const imgWidth = 210 - this.margin * 2;
const imgHeight = (canvas.height * imgWidth) / canvas.width;