I want to generate pdf from json array using node.js and i want these in aws lambda with node.js.i have used many libraries but id doesn't work can you please guide me how can i acheive this
Asked
Active
Viewed 1,719 times
1 Answers
0
app.get('/pdf/', function (req, res, next) {
var PDFDocument = require('pdfkit');
const doc = new PDFDocument();
var json = { list: ['Test', 'Array'], success: true }
doc.fontSize(15)
.fillColor('blue')
.text(JSON.stringify(json, null, 2), 100, 100)
// .link(100, 100, 160, 27, link);
doc.pipe(res);
doc.end();
});
We can use pdfkit node module and JSON.stringfy

Wang Liang
- 4,244
- 6
- 22
- 45