Reputation: 125
Our application frontend is angular and backend is .net web API we want to generate a pdf report for all products used by the user. Here product description is HTML content so we need a way to render Html content and product information into pdf on the server-side.
Right now we are using the Active Reports section report to generate pdf without description because in Active Reports RichText only supports a minimal level of HTML tags we need much more. So we need a better solution to generate pdf with HTML content on server side .
Upvotes: 0
Views: 823
Reputation: 516
You can use html-pdf module to convert your html into pdf. It provides bunch of ways to convert html into pdf. Here are the few of them:
let pdf = require('html-pdf');
pdf.create(html).toFile([filepath, ]function(err, res){
console.log(res.filename);
});
pdf.create(html).toStream(function(err, stream){
stream.pipe(fs.createWriteStream('./foo.pdf'));
});
pdf.create(html).toBuffer(function(err, buffer){
console.log('This is a buffer:', Buffer.isBuffer(buffer));
});
It also let you define options to customize your page.
Upvotes: 0