`;
const element = document.createElement('div');
element.innerHTML = content;
const opt = {
margin: 0.5,
filename: `SOP_${id.replace(/\s+/g, '_')}_v${version}.pdf`,
image: { type: 'jpeg', quality: 0.98 },
html2canvas: { scale: 2 },
jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }
};
if (window.html2pdf) {
html2pdf().set(opt).from(element).save();
} else {
alert("PDF Generator is initializing. Please try again in a few seconds.");
}
}
