I have a task where I need to export the html to pdf.Where the pdf should have same design as it has in browser.Basically I need the css should also work in pdf file. Am using angularjs for front end.
1 Answer
Here is Plunker First run pdfSample.js on cmd as -- node pdfsample.js Then include html and js file in your workspace where you want to get pdf . Then try running as you do .It will work.
pdf.create(renderedHtml, options).toStream(function (err, stream) {
res.setHeader('Content-type', 'application/pdf');
console.log("*****inside pdf create ******");
stream.pipe(res);
stream.pipe(fs.createWriteStream('invoice.pdf'));
});