Market Crash Simulation Training Investor Name: Initial Portfolio Value ($): Your Risk Mitigation Strategy: Simulate Crash Download PDF Risk Mitigation Strategy: ${strategy.replace(/\n/g, "")} `; }; window.downloadCrashPDF = function () { const output = document.getElementById('crashOutput'); if (!output.innerHTML.trim()) { alert("Please run a simulation before downloading the PDF."); return; } html2canvas(output).then(canvas => { const { jsPDF } = window.jspdf; const pdf = new jsPDF(); const imgData = canvas.toDataURL('image/png'); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.addImage(imgData, 'PNG', 0, 10, pdfWidth, pdfHeight); pdf.save("Market_Crash_Simulation.pdf"); }); }; });