Fossil Record Report Generator

Fossil Record Report Generator

Fossil Record Report Generator

Report Preview

Your generated fossil report will appear here. Go to the 'Field Data' tab to begin.

Report Details

Fossil Entries

No fossil entries were added.

'; } ui.logSheet.innerHTML = headerHtml + itemsHtml; ui.noReportMsg.style.display = 'none'; ui.dashboardActions.style.display = 'flex'; // 4. Switch to Dashboard ui.tabs[0].click(); }); // --- Sample Data --- ui.loadSampleBtn.addEventListener('click', () => { nextItemId = 3; reportData = { details: { project: "Hell Creek Formation Survey", lead: "Dr. Mary H. Schweitzer", location: "Site 3B, Harding County, South Dakota, USA", date: "2025-08-15" }, fossils: [ { id: 0, displayId: "SPEC-001", taxon: "Tyrannosaurus rex", description: "Right femur, proximal end", layer: "Upper Hell Creek, Maastrichtian", gps: "45.678 N, -103.556 W", collector: "T. Lyson", notes: "Specimen appears well-preserved, found in sandstone lens. Some pyrite mineralization." }, { id: 1, displayId: "SPEC-002", taxon: "Triceratops horridus", description: "Partial frill (squamosal)", layer: "Upper Hell Creek, Maastrichtian", gps: "45.679 N, -103.557 W", collector: "J. Horner", notes: "Weathered, but identifiable. Found associated with several ceratopsian bone fragments." }, { id: 2, displayId: "SPEC-003", taxon: "Ankylosaurus magniventris", description: "Dermal scute (osteoderm)", layer: "Lower Hell Creek, Maastrichtian", gps: "45.675 N, -103.554 W", collector: "M. Schweitzer", notes: "Complete scute, deep keel. Excellent condition." } ] }; ui.project.value = reportData.details.project; ui.lead.value = reportData.details.lead; ui.location.value = reportData.details.location; ui.date.value = reportData.details.date; renderFossilInputs(); }); // --- PDF Download --- ui.pdfDownloadBtn.addEventListener('click', async () => { ui.pdfDownloadBtn.textContent = "Generating..."; ui.pdfDownloadBtn.disabled = true; try { const { jsPDF } = window.jspdf; container.classList.add("frrg-pdf-export-mode"); const canvas = await html2canvas(ui.logSheet, { scale: 2 }); container.classList.remove("frrg-pdf-export-mode"); const imgData = canvas.toDataURL("image/png"); // Use Landscape orientation for wide table const pdf = new jsPDF({ orientation: "l", unit: "mm", format: "a4" }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const margin = 10; const contentWidth = pdfWidth - margin * 2; const contentHeight = pdfHeight - margin * 2; const imgWidth = canvas.width; const imgHeight = canvas.height; const ratio = imgWidth / imgHeight; let finalImgWidth = contentWidth; let finalImgHeight = finalImgWidth / ratio; if (finalImgHeight > contentHeight) { finalImgHeight = contentHeight; finalImgWidth = finalImgHeight * ratio; } const xPos = (pdfWidth - finalImgWidth) / 2; const yPos = (pdfHeight - finalImgHeight) / 2; pdf.addImage(imgData, "PNG", xPos, yPos, finalImgWidth, finalImgHeight); pdf.save(`${(reportData.details.project || "Fossil_Report").replace(/ /g, "_")}.pdf`); } catch (error) { console.error("PDF Generation Error:", error); alert("An error occurred while creating the PDF."); } finally { ui.pdfDownloadBtn.textContent = "Download Report (PDF)"; ui.pdfDownloadBtn.disabled = false; } }); // --- Initial Call --- renderFossilInputs(); });
Scroll to Top