Step 1: Enter Your Green Bond Details

Provide the specifications of your green bond investment to begin the analysis.

$
%

Step 2: Financial Performance Analysis

Review the calculated returns and yield for your green bond investment.

Current Yield (%)
--
Annual Interest
--
Total Return
--

Interest Payout Schedule

Year Annual Interest Payment Cumulative Interest

Step 3: Estimated Environmental Impact

This is a simulated projection of the positive environmental impact generated by your investment, based on the selected project category.

Step 4: Your Green Bond Report

Review the consolidated summary of your bond's performance and impact. You can download this report as a PDF.

Project Category: ${projectCategoryInput.value}

Financial Performance

${financialResultsHTML} ${amortizationTableHTML}

Estimated Environmental Impact

${impactResultsHTML}
`; } // --- PDF DOWNLOAD FUNCTIONALITY --- downloadPdfBtn.addEventListener('click', function() { if (typeof window.jspdf === 'undefined' || typeof window.html2canvas === 'undefined') { alert("Error: PDF generation library is not available."); return; } const { jsPDF } = window.jspdf; const reportElement = document.getElementById('summaryReport'); if(!reportElement) { alert("Error: Report content element not found."); return; } this.textContent = "Generating..."; this.disabled = true; html2canvas(reportElement, { scale: 2, useCORS: true, logging: false, backgroundColor: '#ffffff' }).then(canvas => { try { const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4', putOnlyUsedFonts:true }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const imgWidth = canvas.width; const imgHeight = canvas.height; const ratio = imgWidth / imgHeight; let pageImgWidth = pdfWidth - 20; let pageImgHeight = pageImgWidth / ratio; let heightLeft = pageImgHeight; let position = 10; if (pageImgHeight > pdfHeight - 20) { pageImgHeight = pdfHeight - 20; // max height with margin pageImgWidth = pageImgHeight * ratio; } pdf.addImage(imgData, 'PNG', 10, position, pageImgWidth, pageImgHeight); heightLeft -= (pdfHeight - 20); while (heightLeft > 0) { position = -heightLeft - 10; pdf.addPage(); pdf.addImage(imgData, 'PNG', 10, position, pageImgWidth, pageImgHeight); heightLeft -= (pdfHeight); } pdf.save(`${(bondNameInput.value || 'Green-Bond').replace(/\s+/g, '-')}-Report.pdf`); } catch(error) { console.error("Failed to generate PDF:", error); alert("An error occurred while generating the PDF."); } finally { this.textContent = "Download PDF Report"; this.disabled = false; } }).catch(err => { console.error("html2canvas failed:", err); alert("Could not render the report for PDF generation."); this.textContent = "Download PDF Report"; this.disabled = false; }); }); // Initialize by showing the first tab showTab(currentTab); });
Scroll to Top