Online Personalized Learning Path Generator

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...

${step.description}

Suggested Resources: ${step.resources}

`).join('') + `

Overall Advice

${data.overallAdvice}

`; loader.style.display = 'none'; pathContent.style.display = 'block'; }; const showError = (message) => { setupError.textContent = message; setupError.style.display = 'block'; }; const hideError = () => { setupError.style.display = 'none'; }; // --- PDF Generation --- async function generatePdf() { const { goal, learningPath, overallAdvice } = lastResult; if (!goal) return; pdfContentArea.innerHTML = `

Learning Path: ${goal}

${learningPath.map(step => `

${step.step}. ${step.title}

${step.description}

Resources: ${step.resources}

`).join('')}

Overall Advice

${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'); });
Scroll to Top