Criminal Record Expungement Eligibility Checker

Criminal Record Expungement Eligibility Checker

Answer a few questions to see if you might be eligible for record expungement in the U.S.

Expungement laws vary greatly by state.

${eligibility.text}

Analysis of Factors

    `; factors.forEach(factor => { const icon = factor.type === 'positive' ? `` : ``; reportHTML += `
  • ${icon}${factor.text}
  • `; }); reportHTML += `
`; document.getElementById('report-output-container').innerHTML = reportHTML; document.getElementById('pdf-download-section').classList.remove('hidden'); lucide.createIcons(); showTab(tabs.length - 1); } async function downloadPdf() { const pdfLoader = document.getElementById('pdf-loader'); const downloadBtn = document.getElementById('downloadPdfBtn'); const content = document.getElementById('report-output'); pdfLoader.classList.remove('hidden'); downloadBtn.disabled = true; try { const canvas = await html2canvas(content, { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const { jsPDF } = window.jspdf; const pdf = new jsPDF('p', 'pt', 'letter'); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const margin = 40; const canvasWidth = canvas.width; const canvasHeight = canvas.height; const ratio = canvasWidth / canvasHeight; const imgWidth = pdfWidth - (margin * 2); const imgHeight = imgWidth / ratio; let heightLeft = imgHeight; let position = margin; if (imgHeight > (pdfHeight - margin * 2)) { // content is larger than one page heightLeft = imgHeight - (pdfHeight - margin * 2); } else { heightLeft = 0; } pdf.addImage(imgData, 'PNG', margin, position, imgWidth, imgHeight); while (heightLeft > 0) { position = position - (pdfHeight - margin * 2); pdf.addPage(); pdf.addImage(imgData, 'PNG', margin, position, imgWidth, imgHeight); heightLeft -= (pdfHeight - margin * 2); } pdf.save('Expungement-Eligibility-Report.pdf'); } catch (error) { console.error("Error generating PDF:", error); alert("There was an error generating the PDF. Please try again."); } finally { pdfLoader.classList.add('hidden'); downloadBtn.disabled = false; } } // Event Listeners generateBtn.addEventListener('click', generateReport); downloadPdfBtn.addEventListener('click', downloadPdf); // Initial UI setup showTab(currentTab); lucide.createIcons(); });
Scroll to Top