Personalized Learning Path Generator
Tell our AI what you want to learn, and we'll create a roadmap for you.
AI is crafting your personalized learning path...
${overallAdvice}
`; pdfContentArea.style.display = 'block'; pdfContentArea.style.position = 'absolute'; pdfContentArea.style.left = '-9999px'; pdfContentArea.style.width = '800px'; try { const canvas = await html2canvas(pdfContentArea, { scale: 2, useCORS: true }); const imgData = canvas.toDataURL('image/png'); const { jsPDF } = window.jspdf; const pdf = new jsPDF({ orientation: 'portrait', unit: 'px', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const imgHeight = canvas.height * pdfWidth / canvas.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, imgHeight); pdf.save(`Learning-Path-${goal.replace(/[^a-z0-9]/gi, '-')}.pdf`); } catch (error) { console.error("PDF generation failed:", error); alert("Could not generate PDF."); } finally { pdfContentArea.style.display = 'none'; } } // --- Event Listeners --- generatePathBtn.addEventListener('click', getLearningPath); downloadReportBtn.addEventListener('click', generatePdf); startOverBtn.addEventListener('click', () => switchView('setup')); // --- Initial State --- switchView('setup'); });