Private School vs. Public School Cost Analyzer
Private School Annual Costs
One-Time Fees
Public School Annual Costs
One-Time Fees
Comparison Summary
Please fill in the details on the 'Private School Costs' and 'Public School Costs' tabs. The summary will be calculated here.
One-Time Fees: ${pscFormatCurrency(results.publicOneTime)}
School Cost Comparison for ${childNameDisplayPDF}
Analysis Period: ${results.years} Year${results.years === 1 ? '' : 's'}
| Description | Private School | Public School |
|---|---|---|
| Estimated Annual Recurring Cost | ${pscFormatCurrency(results.privateAnnual)} | ${pscFormatCurrency(results.publicAnnual)} |
| Total One-Time Fees | ${pscFormatCurrency(results.privateOneTime)} | ${pscFormatCurrency(results.publicOneTime)} |
| Total Estimated Cost Over Period | ${pscFormatCurrency(results.privateTotal)} | ${pscFormatCurrency(results.publicTotal)} |
| Difference (Private - Public) | ${diffTextPDF} | |
Report generated on: ${new Date().toLocaleDateString()} ${new Date().toLocaleTimeString()}
`; document.body.appendChild(pdfContentWrapper); try { const canvas = await html2canvas(pdfContentWrapper, { scale: 2, useCORS: true, backgroundColor: '#ffffff' }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const imgProps = pdf.getImageProperties(imgData); const ratio = Math.min((pdfWidth - 40) / imgProps.width, (pdfHeight - 40) / imgProps.height); pdf.addImage(imgData, 'PNG', (pdfWidth - imgProps.width * ratio) / 2, 20, imgProps.width * ratio, imgProps.height * ratio); pdf.save('School_Cost_Comparison.pdf'); } catch (error) { console.error("Error during PDF generation:", error); alert("An error occurred while generating the PDF."); } finally { document.body.removeChild(pdfContentWrapper); } }