Eco-Friendly Travel Destination Guide

Eco-Friendly Travel Destination Guide

Set your preferences in the 'Preferences' tab and click 'Find Destinations' to see your personalized eco-travel guide here.

${dest.bestSeasons.join(', ')}

Sustainable Activities

    ${dest.activities.map(act => `
  • ${act}
  • `).join('')}
`; }); html += `
`; outputDiv.innerHTML = html; } // --- 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; // Create a temporary header for the PDF 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 => { // Remove the temporary header from the screen view 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 pdfHeight = pdf.internal.pageSize.getHeight(); const canvasAspectRatio = canvas.width / canvas.height; const imgWidth = pdfWidth - 20; const imgHeight = imgWidth / canvasAspectRatio; let heightLeft = imgHeight; let position = 10; pdf.addImage(imgData, 'PNG', 10, position, imgWidth, imgHeight); heightLeft -= (pdfHeight - 20); while (heightLeft > 0) { position = heightLeft - imgHeight + 10; pdf.addPage(); pdf.addImage(imgData, 'PNG', 10, position, imgWidth, imgHeight); heightLeft -= (pdfHeight - 20); } pdf.save('Eco_Friendly_Travel_Guide.pdf'); loader.style.display = 'none'; }); }
Scroll to Top