Market Crash Simulation Training

Market Crash Loss: ${lossPercent}%

Post-Crash Portfolio Value: $${parseFloat(finalValue).toLocaleString()}

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"); }); }; });
Scroll to Top