Sono nuovo su node.js e jsreport, ma quello che sto tentando di fare è creare un pdf in memoria usando node.js e poi salvandolo sul disco. Ho bisogno che questo sia in stand-by perché funzionerà come una funzione AWS Lambda.Come si salva un rendering jsreport su file con nodeJs?
var fs = require('fs');
require("jsreport").render("<h1>Hi there!</h1>").then(function(out) {
//pipe pdf with "Hi there!"
fs.writeFile('C:\\helloworld.pdf', out, function (err) {
if (err) return console.log(err);
console.log('Hello World > helloworld.txt');
});
fs.close();
console.log("The End");
});
Anche se questo corre il pdf uscita non viene aperto in Adobe Reader in modo da assumere l'output file non è un PDF valido.
questo richiede npm installare jsreport
FYI '.writeFile' è asincrona. –