Storytelling Assistant Storytelling Assistant Build your world, one idea at a time. Story Foundation Genre Fantasy Science Fiction Mystery Thriller Horror Romance Historical Fiction Generate Elements Create a Character Describe a Setting Invent a Plot Twist Generated Idea Your next idea will appear here. Brewing a fresh idea... My Storyboard Download PDF My Storyboard ').replace(/<\/h4>/g, '').replace(//g, '').replace(/<\/h3>/g, '')} `).join(''); const contentToPrint = document.getElementById('pdf-output'); contentToPrint.style.display = 'block'; try { const canvas = await html2canvas(contentToPrint, { scale: 2 }); const { jsPDF } = window.jspdf; const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'portrait', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save('My-Storyboard.pdf'); } catch (err) { console.error("Error generating PDF:", err); alert("Could not generate PDF."); } finally { contentToPrint.style.display = 'none'; } } // --- EVENT LISTENERS --- generateBtns.forEach(btn => btn.addEventListener('click', handleGeneration)); downloadPdfBtn.addEventListener('click', handlePdfDownload); // --- INITIALIZATION --- lucide.createIcons(); });