`;
const categoryTitles = { property_basics: 'Property Basics', exterior: 'Exterior & Structure', interior: 'Interior & Systems', neighborhood: 'Neighborhood & Location' };
for (const category in list) {
html += `
`;
});
}
container.innerHTML = html;
downloadBtn.classList.remove('hidden');
}
function downloadPDF() {
const { jsPDF } = window.jspdf;
const pdf = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' });
const contentToPrint = document.getElementById('dashboard-content');
if (!contentToPrint) return;
const checkboxes = contentToPrint.querySelectorAll('input[type="checkbox"]');
checkboxes.forEach(cb => cb.style.display = 'none');
html2canvas(contentToPrint, { scale: 2, useCORS: true }).then(canvas => {
checkboxes.forEach(cb => cb.style.display = 'block');
const imgData = canvas.toDataURL('image/png');
const pdfWidth = pdf.internal.pageSize.getWidth();
const pdfHeight = (canvas.height * pdfWidth) / canvas.width;
let heightLeft = pdfHeight;
let position = 0;
const pageHeight = pdf.internal.pageSize.getHeight();
pdf.addImage(imgData, 'PNG', 10, 10, pdfWidth - 20, pdfHeight > 277 ? 277 : pdfHeight - 20);
heightLeft -= (pageHeight - 20);
while (heightLeft > 0) {
position = -heightLeft - 20;
pdf.addPage();
pdf.addImage(imgData, 'PNG', 10, position, pdfWidth - 20, pdfHeight);
heightLeft -= pageHeight;
}
pdf.save('House-Hunting-Checklist.pdf');
});
}
