我是node.js和jsreport的新手,但我想要做的是使用node.js在内存中创建一个pdf,然后将其保存到磁盘中。我需要这是站在一起,因为它将运行作为一个AWS功能。
var fs = require('fs');
require("jsreport").render("<h1>Hi there!</h1>").then(function(out) {
//pipe pdf with "Hi there!"
fs.writeFile('C:\\helloworld.pdf
2019-04-04T04:34:49.035Z - error: Error when loading extension Error: The module '/media/vishesh/Disc/working/examples/jsreport_pdf_password_install_tryout/node_modules/jsreport-pdf-password/node_modules/hummus/binding/hummus.node'
was compiled against a different Node.js version using
NODE
我已经成功地让我的代码输出了pdf,但是当我试图使用中列出的“页边距”属性使用以下代码调整边距时,
var pdf = require ('pdfkit');
var fs = require('fs');
var doc = new pdf(
{
size: [288,144]
}
);
doc.pipe(fs.createWriteStream('run.pdf'));
doc.font('Times-Roman')
.text('Hello different Times Roman!'