`;
const pdfContent = document.getElementById('pdf-content');
pdfContent.innerHTML = pdfHTML;
// 3. Render and save the PDF
const { jsPDF } = window.jspdf;
pdfContent.classList.remove('invisible'); // Make it renderable
const canvas = await html2canvas(pdfContent, { scale: 2 });
pdfContent.classList.add('invisible'); // Hide it again
const imgData = canvas.toDataURL('image/png');
const pdf = new jsPDF({ orientation: 'portrait', unit: 'pt', format: 'a4' });
const pdfWidth = pdf.internal.pageSize.getWidth();
const pdfHeight = (canvas.height * pdfWidth) / canvas.width;
pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight);
pdf.save('VC_Portfolio_Report.pdf');
} catch (error) {
console.error("PDF generation failed:", error);
alert("Sorry, there was an error creating the PDF.");
} finally {
pdfBtn.innerText = "Download PDF Report";
pdfBtn.disabled = false;
}
}
// --- START THE APP ---
initialize();
});