Build a Solar Oven Tool Solar Oven Tool Solar Oven Performance Estimator 1. Dashboard (Estimator) 2. Data Configuration Select your oven parameters to estimate its performance. Factors can be edited in the 'Data Configuration' tab. Oven Type: Insulation Quality: Weather: Time of Day: Morning (Weak Sun) Solar Noon (Peak Sun) Afternoon (Strong Sun) Outside Temperature: Temperature Unit: °F °C Estimate Performance Estimated Max Temp 300°F Est. Cook Time (1kg Chicken) 2.5 hrs Download Results as PDF Add, edit, or remove the factors used in the estimation. (Spec #4, #6) Oven Types (Base Factor) Add Oven Type Insulation Quality (Multiplier) Add Insulation Type Weather (Multiplier) Add Weather Type ← Previous Next → ${resultTempEl.innerHTML} Est. Cook Time (1kg Chicken) ${resultTimeEl.textContent} `; pdfOutputContent.innerHTML = pdfHtml; } /** * Downloads the output as a PDF * (Spec II.C) */ function downloadSolarPDF() { if ( typeof jspdf === "undefined" || typeof html2canvas === "undefined" ) { console.error("PDF libraries not loaded."); return; } if (!pdfOutputContent || resultsContainer.classList.contains("hidden")) { console.error("No results to download."); return; } const { jsPDF } = jspdf; const pdfOutputElement = document.getElementById("solar-pdf-output-content"); pdfOutputElement.style.display = "block"; pdfOutputElement.style.position = "absolute"; pdfOutputElement.style.left = "-9999px"; html2canvas(pdfOutputElement, { scale: 2, backgroundColor: "#ffffff", }).then((canvas) => { pdfOutputElement.style.display = "none"; pdfOutputElement.style.position = "static"; const imgData = canvas.toDataURL("image/png"); const pdf = new jsPDF({ orientation: "p", unit: "px", format: "a4", }); const pdfWidth = pdf.internal.pageSize.getWidth(); const canvasWidth = canvas.width; const canvasHeight = canvas.height; const ratio = canvasWidth / canvasHeight; const imgWidth = pdfWidth - 40; // 20px margin const imgHeight = imgWidth / ratio; pdf.addImage(imgData, "PNG", 20, 20, imgWidth, imgHeight); pdf.save("solar-oven-estimation.pdf"); }); } pdfDownloadBtn.addEventListener("click", downloadSolarPDF); // --- 6. Initialization --- buildDashboard(); buildConfig(); showSolarTab("solar-tab-dashboard"); // Start on the dashboard tab });