`;
// Food Experiences
if (experiences.length > 0) {
html += `
`;
}
html += `
`;
outputDiv.innerHTML = html;
}
function getDietaryNote(dish, diet) {
if (diet === 'none') return '';
// This is a mock function. A real app would need a more complex database.
if (diet === 'vegetarian' && (dish === "Gumbo" || dish === "Jambalaya")) {
return '(Look for vegetarian versions)';
}
if (diet === 'gluten-free' && (dish === "Beignets" || dish === "Po' Boy Sandwich")) {
return '(Ask for gluten-free options)';
}
return '';
}
// --- PDF Download ---
function downloadPDF() {
const { jsPDF } = window.jspdf;
const loader = document.getElementById('loader');
loader.style.display = 'block';
const content = document.getElementById('pdf-content');
html2canvas(content, { scale: 2 }).then(canvas => {
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('Food_Tour_Guide.pdf');
loader.style.display = 'none';
});
}
Your Food Experiences
-
${experiences.map(exp => `
- ${exp.replace('-', ' ').replace(/\b\w/g, l => l.toUpperCase())}: ${data.experiences[exp]} `).join('')}
