diff --git a/src/components/Tutorials.astro b/src/components/Tutorials.astro index 589e933..46c0ee8 100644 --- a/src/components/Tutorials.astro +++ b/src/components/Tutorials.astro @@ -60,8 +60,17 @@ function downloadPDF(elementId, title) { jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' } }; + // Create temporary element + const worker = document.createElement('div'); + worker.innerHTML = html; + worker.style.position = 'absolute'; + worker.style.left = '-9999px'; + document.body.appendChild(worker); + // PDF generieren - html2pdf().set(opt).from(html).save(); + html2pdf().set(opt).from(worker).save().then(() => { + document.body.removeChild(worker); + }); }