diff --git a/public/index.html b/public/index.html
index ea6bf33..2bbf4bf 100644
--- a/public/index.html
+++ b/public/index.html
@@ -72,6 +72,7 @@ body.modal-open { overflow: hidden; }
+
@@ -494,14 +495,27 @@ function closeAiModal(){
document.body.classList.remove('modal-open');
}
-function downloadPdf(){
- const printWin = window.open('', '_blank');
- if (!printWin) return;
- const cardsHtml = app.innerHTML;
- const css = [...document.querySelectorAll('style')].map(s=>s.textContent||'').join('\n');
- printWin.document.write(`
Coachingcards PDF${cardsHtml}
`);
- printWin.document.close();
- printWin.onload = () => setTimeout(() => printWin.print(), 200);
+async function downloadPdf(){
+ if (!window.html2pdf) {
+ alert('PDF-Export-Bibliothek nicht geladen.');
+ return;
+ }
+ const root = document.createElement('div');
+ root.style.background = '#fff';
+ root.style.padding = '8px';
+ root.innerHTML = app.innerHTML;
+ root.querySelectorAll('.card-actions,.card-action-btn,button,[data-edit-all]').forEach(el => el.remove());
+
+ const opt = {
+ margin: [8, 8, 8, 8],
+ filename: `coachingcards-${new Date().toISOString().slice(0,10)}.pdf`,
+ image: { type: 'jpeg', quality: 0.96 },
+ html2canvas: { scale: 2, useCORS: true, backgroundColor: '#ffffff' },
+ jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' },
+ pagebreak: { mode: ['css', 'legacy'] }
+ };
+
+ await window.html2pdf().set(opt).from(root).save();
}
async function syncActiveJob(){