Space Mission Simulator / Log Generator
Mission Log: [Codename]
M-DAY 0.0: Standby for log generation...
tags .replace(/<\/p>/g, '\n') // Replace
with newline .replace(/(.*?)<\/strong>/g, '$1') // Remove tags but keep content .replace(/(.*?)<\/span>/g, '$1') // Remove span tags but keep content .trim(); // Trim whitespace const logLines = doc.splitTextToSize(logTextForPDF, textWidth); logLines.forEach(line => { const requiredHeight = (normalFontSize * 0.4) + lineSpacing; if (yPos + requiredHeight > doc.internal.pageSize.getHeight() - 15) { // Page break check doc.addPage(); yPos = 15; // Reset font doc.setFont(logFont, 'normal'); doc.setFontSize(normalFontSize); doc.setTextColor(textColorPDF); } doc.text(line, leftMargin, yPos); yPos += lineSpacing; // Simple line spacing for mono font }); // Save PDF const safeCodename = currentMission.codename.replace(/[^a-z0-9]/gi, '_').toLowerCase(); doc.save(`mission_log_${safeCodename}.pdf`); } catch(error) { console.error("Error generating PDF:", error); alert("Subspace interference corrupted the PDF printer! Check console (F12)."); } }); }); // End DOMContentLoaded