`;
});
} else {
reportHTML += ``;
}
guideContent.innerHTML = reportHTML;
resultsContainer.classList.remove('hidden');
resultsContainer.scrollIntoView({ behavior: 'smooth' });
};
generateBtn.addEventListener('click', generateGuide);
downloadPdfBtn.addEventListener('click', () => {
const { jsPDF } = window.jspdf;
const pdfContent = document.getElementById('pdf-content');
const pdfHeader = document.getElementById('pdf-header');
if (!pdfContent || !pdfHeader) return;
document.getElementById('pdf-generation-date').textContent = new Date().toLocaleDateString('en-US');
pdfHeader.classList.remove('hidden');
html2canvas(pdfContent, { scale: 2, useCORS: true }).then(canvas => {
const imgData = canvas.toDataURL('image/png');
const pdf = new jsPDF({ orientation: 'portrait', unit: 'pt', format: 'a4' });
const pdfWidth = pdf.internal.pageSize.getWidth();
const pdfHeight = pdf.internal.pageSize.getHeight();
const margin = 40;
const contentWidth = pdfWidth - (margin * 2);
const imgProps = pdf.getImageProperties(imgData);
const contentHeight = (imgProps.height * contentWidth) / imgProps.width;
let heightLeft = contentHeight;
let position = margin;
pdf.addImage(imgData, 'PNG', margin, position, contentWidth, contentHeight);
heightLeft -= (pdfHeight - (margin * 2));
while (heightLeft > 0) {
position = heightLeft - contentHeight + margin;
pdf.addPage();
pdf.addImage(imgData, 'PNG', margin, position, contentWidth, contentHeight);
heightLeft -= (pdfHeight - (margin * 2));
}
pdf.save('Personal_Data_Protection_Guide.pdf');
pdfHeader.classList.add('hidden');
}).catch(err => {
console.error("Error generating PDF:", err);
pdfHeader.classList.add('hidden');
});
});
});
Low Risk
Your practices appear to follow general data protection principles. Continue to monitor regulations and maintain your high standards.
