Lesson Plan Generator

Lesson Plan Generator

Create structured lesson plans with AI

Lesson Details

Generated Lesson Plan

Your lesson plan will appear here.

Fill in the details and click "Generate Plan".

Subject: ${subjectInput.value} | Grade Level: ${gradeLevelInput.value} | Duration: ${durationInput.value} mins

`; pdfContentEl.innerHTML = lessonPlanOutput.innerHTML.replace(/

/g, '

').replace(/<\/h3>/g, '

'); contentToPrint.style.display = 'block'; try { const canvas = await html2canvas(contentToPrint, { scale: 2, windowWidth: 1200 }); 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', 20, 20, pdfWidth - 40, pdfHeight - 40); pdf.save(`Lesson-Plan-${topicInput.value.replace(/\s+/g, '-')}.pdf`); } catch (err) { console.error("Error generating PDF:", err); alert("Could not generate PDF. Please try again."); } finally { contentToPrint.style.display = 'none'; } } // --- EVENT LISTENERS --- generateBtn.addEventListener('click', handleGeneration); downloadPdfBtn.addEventListener('click', handlePdfDownload); // --- INITIALIZATION --- lucide.createIcons(); });
Scroll to Top