Small-Cap vs. Large-Cap Investment Profile Analyzer
Compare potential returns and self-assess risk levels for hypothetical Small-Cap and Large-Cap investments.
** VERY IMPORTANT - PLEASE READ **
- This tool is for educational and illustrative purposes ONLY.
- Investment outcomes are based on **your manually entered expected returns and subjective risk assessments.** They do NOT reflect actual market data or predictions.
- Past performance is not indicative of future results. All investments carry risk. Small-cap stocks are generally considered higher risk than large-cap stocks.
- This tool **DOES NOT provide investment advice.** Always conduct thorough research and consult with a qualified financial advisor.
Notes: ${r.largeCapInputs.notes.replace(/\n/g, '
')}
Projected Results:
`; pdfHtml += `Future Value: ${this.formatCurrency(r.largeCapCalcs.futureValue,false)}
`;
pdfHtml += `Total Growth: ${this.formatCurrency(r.largeCapCalcs.totalGrowth,false)}
`;
pdfHtml += `Small-Cap Scenario
`;
pdfHtml += `
`;
pdfHtml += `Inputs:
`; pdfHtml += `Est. Annual Return: ${parseFloat(r.smallCapInputs.annualReturn).toFixed(2)}
`;
pdfHtml += `Assessed Risk Level: ${r.smallCapInputs.riskLevel}
`;
if(r.smallCapInputs.notes) pdfHtml += `Notes: ${r.smallCapInputs.notes.replace(/\n/g, '
')}
Projected Results:
`; pdfHtml += `Future Value: ${this.formatCurrency(r.smallCapCalcs.futureValue,false)}
`;
pdfHtml += `Total Growth: ${this.formatCurrency(r.smallCapCalcs.totalGrowth,false)}
`;
pdfHtml += `General Qualitative Comparison
| Feature | Large-Cap Stocks | Small-Cap Stocks |
|---|---|---|
| ${item.factor} | ${item.largeCap} | ${item.smallCap} |
Observations Based on Your Inputs
${observationsContainerEl.innerHTML.replace(/
`;
}
pdfExportContainer.innerHTML = pdfHtml;
document.body.appendChild(pdfExportContainer);
try {
const canvas = await html2canvas(pdfExportContainer, { scale: 1.2, useCORS: true, logging: false, windowWidth: pdfExportContainer.scrollWidth, windowHeight: pdfExportContainer.scrollHeight });
document.body.removeChild(pdfExportContainer);
const imgData = canvas.toDataURL('image/png');
const { jsPDF } = window.jspdf;
const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' });
const pdfWidth = pdf.internal.pageSize.getWidth();
const pdfHeight = pdf.internal.pageSize.getHeight();
let imgFinalWidth = pdfWidth - 40;
let imgFinalHeight = (canvas.height * imgFinalWidth) / canvas.width;
let position = 20;
let heightProcessed = 0;
const pageMargin = 20;
const pageHeightAvailable = pdfHeight - 2 * pageMargin;
while(heightProcessed < canvas.height) {
let pageSegmentHeightOnCanvas = Math.min(canvas.height - heightProcessed, (pageHeightAvailable / imgFinalHeight) * canvas.height );
if (pageSegmentHeightOnCanvas <=0) break;
const segmentCanvas = document.createElement('canvas');
segmentCanvas.width = canvas.width; segmentCanvas.height = pageSegmentHeightOnCanvas;
const sctx = segmentCanvas.getContext('2d');
sctx.drawImage(canvas, 0, heightProcessed, canvas.width, pageSegmentHeightOnCanvas, 0, 0, canvas.width, pageSegmentHeightOnCanvas);
const segmentImgData = segmentCanvas.toDataURL('image/png');
if(heightProcessed > 0) pdf.addPage();
pdf.addImage(segmentImgData, 'PNG', pageMargin, pageMargin, imgFinalWidth, (segmentCanvas.height * imgFinalWidth) / segmentCanvas.width);
heightProcessed += pageSegmentHeightOnCanvas;
}
pdf.save('SmallCap_vs_LargeCap_Analysis.pdf');
} catch (error) {
console.error("Error generating PDF:", error);
alert("An error occurred while generating PDF.");
if (document.body.contains(pdfExportContainer)) document.body.removeChild(pdfExportContainer);
}
}
};
document.addEventListener('DOMContentLoaded', function() {
sclcApp.init();
});
