From 0ebdc77bc9c37e96f3528428d445d659212c7eb8 Mon Sep 17 00:00:00 2001 From: DanielRamirezGe Date: Mon, 7 Oct 2019 15:55:00 -0500 Subject: [PATCH] modificaciond de pdf --- package.json | 3 ++- routes/pdf.js | 43 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 95ebbdc..5ac4b93 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "qr-image": "^3.2.0", "qrcode-generator": "^1.4.4", "validator": "^11.1.0", - "voilab-pdf-table": "^0.5.0" + "voilab-pdf-table": "^0.5.0", + "xlsx": "^0.15.1" } } diff --git a/routes/pdf.js b/routes/pdf.js index 98f8792..6518fce 100644 --- a/routes/pdf.js +++ b/routes/pdf.js @@ -14,8 +14,7 @@ let g_pdf = async function(idPersona) { let inicio = 120; - - + var datetime = new Date(); doc.image(__dirname + '/Imagenes/logo_unam.png', inicio, 30, { scale: 0.04 }); @@ -39,6 +38,24 @@ let g_pdf = async function(idPersona) { doc.moveTo(70, 110) .lineTo(542, 110); + console.log(datetime); + let d = datetime.getDate(); + let m = datetime.getMonth(); + let a = datetime.getFullYear(); + if (d < 10) { + let aux = `0${d}`; + d = aux; + + } + if (m < 10) { + let aux = `0${m}`; + m = aux; + + } + + doc.font('Times-Roman') + .fontSize(13) + .text(`${d}/${m}/${a}`, inicio + 305, 120); let marg = 70; doc.image(__dirname + `/Imagenes/persona_${idPersona}.png`, marg, 120, { scale: 0.85 }); @@ -52,8 +69,21 @@ let g_pdf = async function(idPersona) { .fontSize(13) .text('CONFERENCIAS', inicio + 142, 240); + doc.font('Times-Roman') + .fontSize(12) + .text('Nota:', marg, 270); + doc.font('Times-Roman') + .fontSize(10) + .text(` 1.- Presentarse 10 minutos antes de que inicie la actividad.`, marg, 285); + doc.font('Times-Roman') + .fontSize(10) + .text(' 2.- Todas las actividades serán en el auditorio 901, excepto la Feria se llevará acabo en el Corredor Multidisciplinario.', marg, 295); + + doc.font('Times-Roman') + .fontSize(12) + .text('', marg, 300); var table1 = { headers: ['Nombre', 'Fecha ', 'Hora'], rows: [] @@ -102,11 +132,16 @@ let g_pdf = async function(idPersona) { } let uno = `${dia}/${mes}/${anio}`; - let dos = `${hora}:${min}`; + let dos = ""; + if (results[index].idConferencia == 7) + dos = `${hora}:${min} - 16:00`; + else + dos = `${hora}:${min}`; + table1.rows.push([results[index].nombre, uno, dos]) } - doc.moveDown().table(table1, 70, 270, { width: 470 }); + doc.moveDown().table(table1, 70, 340, { width: 470 }); doc.end(); }); return;