-
-
Save parzibyte/e7793205edb38abac095a04c24503c96 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get('/', (peticion, respuesta) => { | |
// Podemos acceder a la petición HTTP | |
const valorPasadoPorNode = "Soy un valor pasado desde JavaScript"; | |
contenidoHtml = contenidoHtml.replace("{{valor}}", valorPasadoPorNode); | |
pdf.create(contenidoHtml).toStream((error, stream) => { | |
if (error) { | |
respuesta.end("Error creando PDF: " + error) | |
} else { | |
respuesta.setHeader("Content-Type", "application/pdf"); | |
stream.pipe(respuesta); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment