|
|
|
|
|
|
|
|
|
|
|
|
|
|
(function(){
|
|
|
|
|
|
function descargarPDF() {
|
|
|
try {
|
|
|
const { jsPDF } = window.jspdf;
|
|
|
const doc = new jsPDF({ unit: "pt", format: "a4" });
|
|
|
|
|
|
const title = (document.getElementById("reportTitle").value || "").trim() || "Reporte Consumertec";
|
|
|
const s6 = (document.getElementById("textOutput").textContent || "").trim();
|
|
|
const s5 = (document.getElementById("numericOutput").textContent || "").trim();
|
|
|
|
|
|
doc.setFontSize(14);
|
|
|
doc.text(title, 40, 50);
|
|
|
doc.setFontSize(11);
|
|
|
|
|
|
const text = "SECCIÓN 6 (LLM)\n\n" + (s6 || "(vacío)") + "\n\nSECCIÓN 5 (EVIDENCIA NUMÉRICA)\n\n" + (s5 || "(vacío)");
|
|
|
const lines = doc.splitTextToSize(text, 520);
|
|
|
doc.text(lines, 40, 80);
|
|
|
|
|
|
const filenameSafe = title.replace(/[\\\/:*?"<>|]+/g, "_").slice(0, 80);
|
|
|
doc.save(filenameSafe + ".pdf");
|
|
|
} catch (e) {
|
|
|
alert("No se pudo generar el PDF: " + e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
window.descargarPDF = descargarPDF;
|
|
|
|
|
|
})(); |