diff --git a/public/index.html b/public/index.html
index 2bbf4bf..da77eb6 100644
--- a/public/index.html
+++ b/public/index.html
@@ -500,22 +500,43 @@ async function downloadPdf(){
alert('PDF-Export-Bibliothek nicht geladen.');
return;
}
+
const root = document.createElement('div');
+ root.style.position = 'fixed';
+ root.style.left = '0';
+ root.style.top = '0';
+ root.style.width = '210mm';
+ root.style.minHeight = '297mm';
root.style.background = '#fff';
- root.style.padding = '8px';
+ root.style.padding = '8mm';
+ root.style.zIndex = '-1';
+ root.style.opacity = '0.01';
+ root.style.pointerEvents = 'none';
root.innerHTML = app.innerHTML;
+
root.querySelectorAll('.card-actions,.card-action-btn,button,[data-edit-all]').forEach(el => el.remove());
+ root.querySelectorAll('.exercise-container').forEach(el => { el.style.pageBreakAfter = 'always'; });
+ root.querySelectorAll('.card-size').forEach(el => {
+ el.style.boxShadow = 'none';
+ el.style.margin = '0 auto 10mm auto';
+ });
+
+ document.body.appendChild(root);
const opt = {
- margin: [8, 8, 8, 8],
+ margin: [5, 5, 5, 5],
filename: `coachingcards-${new Date().toISOString().slice(0,10)}.pdf`,
- image: { type: 'jpeg', quality: 0.96 },
- html2canvas: { scale: 2, useCORS: true, backgroundColor: '#ffffff' },
+ image: { type: 'jpeg', quality: 0.98 },
+ html2canvas: { scale: 2, useCORS: true, backgroundColor: '#ffffff', logging: false },
jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' },
pagebreak: { mode: ['css', 'legacy'] }
};
- await window.html2pdf().set(opt).from(root).save();
+ try {
+ await window.html2pdf().set(opt).from(root).save();
+ } finally {
+ root.remove();
+ }
}
async function syncActiveJob(){