This commit is contained in:
Torsten Schulz
2025-07-15 18:16:08 +02:00
parent b6dd39dda3
commit d0544da1ba

View File

@@ -20,9 +20,20 @@ class PDFGenerator {
}
async addSchedule(element) {
const originalFontSize = element.style.fontSize;
element.style.fontSize = '12pt';
const canvas = await html2canvas(element, { scale: 2 });
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 imgData = canvas.toDataURL('image/png');
const imgWidth = 210 - this.margin * 2;
const imgHeight = (canvas.height * imgWidth) / canvas.width;