`;
outputDiv.innerHTML = html;
}
function generateVisaCard(visa, userIncome, userFunds, isEligible) {
const statusColor = isEligible ? 'green' : 'red';
const statusText = isEligible ? 'Met' : 'Not Met';
const incomeCheck = userIncome >= visa.income;
const fundsCheck = userFunds >= visa.funds;
return `
`;
}
// --- PDF Download ---
function downloadPDF() {
const { jsPDF } = window.jspdf;
const loader = document.getElementById('loader');
loader.style.display = 'block';
const content = document.getElementById('pdf-content');
const originalTitle = document.querySelector('h1').innerText;
const pdfHeader = document.createElement('h1');
pdfHeader.innerText = originalTitle;
pdfHeader.className = 'text-2xl font-bold text-gray-800 mb-6 text-center';
content.prepend(pdfHeader);
html2canvas(content, { scale: 2 }).then(canvas => {
pdfHeader.remove();
const imgData = canvas.toDataURL('image/png');
const pdf = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' });
const pdfWidth = pdf.internal.pageSize.getWidth();
const imgWidth = pdfWidth - 20;
const imgHeight = canvas.height * imgWidth / canvas.width;
let heightLeft = imgHeight;
let position = 10;
pdf.addImage(imgData, 'PNG', 10, position, imgWidth, imgHeight);
heightLeft -= (pdf.internal.pageSize.getHeight() - 20);
while (heightLeft > 0) {
position = heightLeft - imgHeight + 10;
pdf.addPage();
pdf.addImage(imgData, 'PNG', 10, position, imgWidth, imgHeight);
heightLeft -= (pdf.internal.pageSize.getHeight() - 20);
}
pdf.save('Digital_Nomad_Visa_Guide.pdf');
loader.style.display = 'none';
});
}
${visa.country}
${isEligible ? "Eligible" : "Not Eligible"}
Min. Monthly Income:
$${visa.income.toLocaleString()}
${visa.income > 0 ? `(${incomeCheck ? '✓' : '✗'})` : '(N/A)'}
Min. Proof of Funds:
$${visa.funds.toLocaleString()}
${visa.funds > 0 ? `(${fundsCheck ? '✓' : '✗'})` : '(N/A)'}
Notes:
${visa.notes}
