Apartment vs. House Cost-Benefit Analyzer

Cost Comparison

Apartment House
Rent/Mortgage $1,200 $1,800
Utilities $150 $250
Taxes & Insurance $0 $300
Maintenance $20 $100
Total Monthly $1,370 $2,450

Summary Report

Occupants: ${occupants}

Monthly Costs:

  • Apartment: $${totalApartment}
  • House: $${totalHouse}

Recommendation: ${recommendationDiv.textContent}

`; document.getElementById("pdfContent").innerHTML = pdfContent; }; // Load jsPDF dynamically const script = document.createElement('script'); script.src = 'https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js'; document.head.appendChild(script); window.generatePDF = function() { const { jsPDF } = window.jspdf; const doc = new jsPDF(); const lines = [ "Apartment vs. House Cost-Benefit Analysis", "", `Location Preference: ${document.getElementById("location").value}`, `Housing Interest: ${document.getElementById("housingType").value}`, `Monthly Budget: $${document.getElementById("monthlyBudget").value}`, `Recommended Apartment Cost: $${document.getElementById("totalApartment").innerText.replace('$','')}`, `Recommended House Cost: $${document.getElementById("totalHouse").innerText.replace('$','')}`, `Recommendation: ${document.getElementById("recommendation").textContent}`, ]; doc.setFontSize(14); lines.forEach((line, i) => { doc.text(line, 10, 20 + i * 10); }); doc.save("housing_comparison.pdf"); }; });
Scroll to Top