Tenant Rights Compliance Checker

Tenant Rights Compliance Checker

Assess your lease agreement against common tenant protection standards in the U.S.

This is crucial as tenant rights vary significantly by state.

${res.question}

Your Answer: ${res.answer}

Note: ${res.note}

${statusText}
`; }); reportHTML += `
`; outputDiv.innerHTML = reportHTML; lucide.createIcons(); showTab(tabs.length - 1); } async function downloadPdf() { const pdfLoader = document.getElementById('pdf-loader'); const downloadBtn = document.getElementById('downloadPdfBtn'); const content = document.getElementById('pdf-content'); 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', 'a4'); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const canvasWidth = canvas.width; const canvasHeight = canvas.height; const ratio = canvasWidth / canvasHeight; const imgWidth = pdfWidth - 80; // with margin const imgHeight = imgWidth / ratio; let heightLeft = imgHeight; let position = 40; pdf.addImage(imgData, 'PNG', 40, position, imgWidth, imgHeight); heightLeft -= (pdfHeight - 80); while (heightLeft > 0) { position -= (pdfHeight - 80); pdf.addPage(); pdf.addImage(imgData, 'PNG', 40, position, imgWidth, imgHeight); heightLeft -= (pdfHeight - 80); } pdf.save('Tenant-Rights-Compliance-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