Peer-to-Peer Lending Return Estimator
Investment Details
Risk & Platform Fees (Annualized)
Estimated Annual Returns
Please complete all previous sections and click "Estimate Returns" on the "Risk & Fees" tab.
Net Estimated Annual Return: ${p2p_allInputsData.results["Net Estimated Annual Return"]}
Net Estimated Annual ROI: ${p2p_allInputsData.results["Net Estimated Annual ROI"]}
`; downloadButton.style.display = 'block'; resultsTabLink.disabled = false; resultsTabLink.click(); // Switch to results tab } else { console.error("Results display elements not found."); } } window.p2p_downloadPDF = function() { const { jsPDF } = window.jspdf; if (!jsPDF || !p2p_allInputsData.inputs) { // Check if p2p_allInputsData is populated alert("PDF library not loaded or no data to export. Please calculate returns first."); return; } const doc = new jsPDF(); let yPos = 20; const lineHeight = 7; const indent = 5; const pageMargin = 15; const pageWidth = doc.internal.pageSize.getWidth(); function addTitle(titleText) { doc.setFontSize(18); doc.setTextColor(44, 62, 80); // #2c3e50 doc.text(titleText, pageWidth / 2, yPos, { align: 'center' }); yPos += lineHeight * 2.5; } function addSection(title, dataObject) { if (yPos > doc.internal.pageSize.getHeight() - pageMargin - (Object.keys(dataObject).length * lineHeight * 1.2) - (lineHeight*2)) { doc.addPage(); yPos = pageMargin; } doc.setFontSize(13); doc.setFont(undefined, 'bold'); doc.setTextColor(0, 86, 179); // #0056b3 doc.text(title, pageMargin, yPos); yPos += lineHeight * 1.5; doc.setFontSize(10); doc.setFont(undefined, 'normal'); doc.setTextColor(51,51,51); // #333 for (const [key, value] of Object.entries(dataObject)) { if (yPos > doc.internal.pageSize.getHeight() - pageMargin - lineHeight) { doc.addPage(); yPos = pageMargin; } doc.text(`${key}:`, pageMargin + indent, yPos); doc.text(String(value), pageMargin + indent + 80, yPos, {align: 'left'}); yPos += lineHeight * 1.2; } yPos += lineHeight * 0.5; } addTitle("Peer-to-Peer Lending Return Estimate"); addSection("Input Parameters (Annualized)", p2p_allInputsData.inputs); addSection("Estimated Returns Breakdown (Annual)", p2p_allInputsData.calculations); addSection("Key Estimated Return Metrics (Annual)", p2p_allInputsData.results); doc.save('P2P_Lending_Return_Estimate.pdf'); }