var result = "";
result = "<Html>"
result += "<style>";
result += "thead, th { border: 1px solid black; text - align: center; font-family='Calibri'; height:15px;font-weight: normal; font-size:12px; }";
result += "body{font-family='Calibri';font-size:15px; } ";
result += " td {text-align: center; font-family='Calibri'; height:15px;font-weight: normal; font-size:12px; }";
result += "</style >";
result += "<body>";
result += "<div style='color: #993300; font-weight:normal;'><hr><center>Total Revenue Statement</center><hr></div>";
result += "<div><span style='float:left;'>Name : 'Nikh' <br> FAR Repcode : '1234' <br> FAR Status : 'Active'</span><span style='float:right;'>Referance Number : <span style='font-weight:normal;'> 12345</span> <br>Payoutdate : 01/02/2019</span></div>";
result += "<div style='clear:both;'></div><hr>";
result += "<div>Total Revenue payable upon revenue received by FAA</div>";
result += "<hr>";
result += "</body>";
result += "</Html>";
var options = {
format: "Letter", // allowed units: A3, A4, A5, Legal, Letter, Tabloid
orientation: "landscape",
timeout: 600000,
"border": {
"top": "0.5in", // default is 0, units: mm, cm, in, px
"right": "0.5in",
"bottom": "1.5in",
"left": "0.5in"
}
};
Gen_pdf.create(result, options).toBuffer(function (err, buffer) {
res.writeHead(200, {
'Content-Type': 'application/pdf'
// 'Content-Disposition': 'attachment; filename="filename.pdf"'
});
const download = Buffer.from(buffer, 'base64');
res.end(download);
});
我也面临着同样的问题,它在本地工作正常,但是在linux服务器上却无法正常工作,缓冲区输出值作为生成/ var / projects / dev / facommtrack / node_modules / phantomjs-prebuilt / lib / phantom \ bin \ phantomjs.exe ENOENT