Online Exam Revision Checklist Generator

Exam Revision Checklist Generator

Enter your exam details to create a custom study checklist.

Exam Date: ${new Date(examDetails.date).toLocaleDateString('en-US', { dateStyle: 'full' })}

`; topicElements.forEach(topicEl => { const topicTitle = topicEl.querySelector('h3').textContent; pdfHtml += `

${topicTitle}

    `; const taskElements = topicEl.querySelectorAll('.task-item'); taskElements.forEach(taskEl => { const checkbox = taskEl.querySelector('input[type="checkbox"]'); const label = taskEl.querySelector('label').textContent; const isChecked = checkbox.checked; pdfHtml += `
  • [${isChecked ? 'X' : ' '}] ${label}
  • `; }); pdfHtml += `
`; }); pdfContentArea.innerHTML = pdfHtml; pdfContentArea.style.display = 'block'; pdfContentArea.style.position = 'absolute'; pdfContentArea.style.left = '-9999px'; pdfContentArea.style.width = '800px'; try { const canvas = await html2canvas(pdfContentArea, { scale: 2 }); 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(`Exam-Checklist-${examDetails.subject.replace(/[^a-z0-9]/gi, '-')}.pdf`); } catch (error) { console.error("Failed to generate PDF:", error); alert("Sorry, there was an error creating the PDF file."); } finally { pdfContentArea.style.display = 'none'; } } // --- Event Listeners --- generateBtn.addEventListener('click', generateChecklist); startOverBtn.addEventListener('click', () => switchView('setup')); downloadPdfBtn.addEventListener('click', generatePdf); // --- Initial State --- function setInitialDate() { const now = new Date(); now.setDate(now.getDate() + 14); // Default to two weeks from now const year = now.getFullYear(); const month = String(now.getMonth() + 1).padStart(2, '0'); const day = String(now.getDate()).padStart(2, '0'); examDateInput.value = `${year}-${month}-${day}`; } setInitialDate(); examTopicsInput.value = "Topic 1: Foundational Concepts\nTopic 2: Core Principles\nTopic 3: Advanced Applications\nTopic 4: Case Studies"; switchView('setup'); });
Scroll to Top