Indigenous Cultures History Map
Culture Name
Indigenous Culture Report
Culture Name
Region: ${culture.region}
Population: ${culture.population}
Language(s): ${culture.language}
History
${culture.history}
Traditions
${culture.traditions}
`; downloadButton.disabled = false; // Scroll to info section cultureInfo.scrollIntoView({ behavior: 'smooth' }); } downloadButton.addEventListener('click', function() { if (!currentCulture) return; const element = document.getElementById('pdf-report'); const opt = { margin: [15, 10, 15, 10], filename: `${currentCulture.name.replace(/\s+/g, '_')}_Report.pdf`, image: { type: 'jpeg', quality: 0.98 }, html2canvas: { scale: 2, useCORS: true, logging: false }, jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' } }; // Make element temporarily visible for rendering element.style.visibility = 'visible'; element.style.position = 'fixed'; element.style.height = 'auto'; element.style.left = '0'; element.style.top = '0'; element.style.zIndex = '9999'; element.style.opacity = '1'; html2pdf().set(opt).from(element).save().then(function() { // Hide element again element.style.visibility = 'hidden'; element.style.position = 'fixed'; element.style.height = '0'; element.style.left = '-9999px'; element.style.zIndex = '-1'; element.style.opacity = '0'; }).catch(function(err) { console.error("PDF generation failed:", err); // Ensure element is hidden on error element.style.visibility = 'hidden'; element.style.position = 'fixed'; element.style.height = '0'; element.style.left = '-9999px'; element.style.zIndex = '-1'; element.style.opacity = '0'; }); }); }); })();