Astronomy Log Generator

Astronomy Observation Log

AstroLog

Observation Planner & Field Recorder

New Observation
Total Observations: 0

No observations recorded yet. Clear skies!

Export Field Report

Generate a printable PDF of your entire observation session, including sketches and metadata.

Astronomy Field Report

Generated by AstroLog

Date: ${log.date} | Time: ${log.time}

Equipment: ${log.equip} | Mag: ${log.mag} | Seeing: ${log.seeing}/5

${log.notes}

`; pdfBody.appendChild(row); }); // Generate const element = document.getElementById('al-pdf-content'); try { // Need to remove display none for capture, but it's positioned off screen so okay const canvas = await html2canvas(element, { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF('p', 'mm', 'a4'); const width = pdf.internal.pageSize.getWidth(); const height = pdf.internal.pageSize.getHeight(); // Calc image height to fit width const imgProps = pdf.getImageProperties(imgData); const pdfHeight = (imgProps.height * width) / imgProps.width; // Simple handling: if long, scale or cut (for this MVP we fit to one page width) // A more complex app would paginate. if(pdfHeight > height) { // If content is too long, we might need multiple pages. // For simplicity here, we stick to basic adding. let heightLeft = pdfHeight; let position = 0; pdf.addImage(imgData, 'PNG', 0, position, width, pdfHeight); heightLeft -= height; while (heightLeft >= 0) { position = heightLeft - pdfHeight; pdf.addPage(); pdf.addImage(imgData, 'PNG', 0, position, width, pdfHeight); heightLeft -= height; } } else { pdf.addImage(imgData, 'PNG', 0, 0, width, pdfHeight); } pdf.save('AstroLog_Report.pdf'); } catch (err) { console.error(err); alert("Error generating PDF"); } }; });
Scroll to Top