diff --git a/public/index.html b/public/index.html index 6d8864f..7546621 100644 --- a/public/index.html +++ b/public/index.html @@ -498,17 +498,8 @@ function closeAiModal(){ } async function downloadPdf(){ - const fallbackWin = window.open('', '_blank'); - const openPrintFallback = (msg='') => { - if (msg) alert(msg); - if (!fallbackWin) return; - fallbackWin.document.write(`Coachingcards PDF${app.innerHTML}`); - fallbackWin.document.close(); - fallbackWin.onload = () => setTimeout(() => fallbackWin.print(), 200); - }; - if (!window.html2canvas || !window.jspdf?.jsPDF) { - openPrintFallback('PDF-Export-Bibliothek nicht geladen. Nutze Fallback-Druckdialog.'); + alert('PDF-Export-Bibliothek nicht geladen.'); return; } @@ -542,15 +533,12 @@ async function downloadPdf(){ const usableH = pageH - margin * 2; for (let i = 0; i < cards.length; i++) { - const canvas = await Promise.race([ - window.html2canvas(cards[i], { - scale: 2, - useCORS: true, - backgroundColor: '#ffffff', - logging: false - }), - new Promise((_, rej) => setTimeout(() => rej(new Error('Render timeout')), 15000)) - ]); + const canvas = await window.html2canvas(cards[i], { + scale: 2, + useCORS: true, + backgroundColor: '#ffffff', + logging: false + }); const img = canvas.toDataURL('image/jpeg', 0.98); const imgW = canvas.width; const imgH = canvas.height; @@ -565,10 +553,6 @@ async function downloadPdf(){ } pdf.save(`coachingcards-${new Date().toISOString().slice(0,10)}.pdf`); - if (fallbackWin && !fallbackWin.closed) fallbackWin.close(); - } catch (e) { - console.error('PDF export failed', e); - openPrintFallback('PDF-Export fehlgeschlagen – öffne Druckdialog als Fallback.'); } finally { root.remove(); }