How to create a PDF file in node.js

I want to generate a module that will generate a PDF, accepting the input as my invoice and that the PDF file sends the email id to clients automatically. In the first step, I got some code and try to create a PDF. This code works and I can generate a PDF. but I can not open the file.

for code I use this link: http://github.com/marak/pdf.js/

+4
source share
1 answer

Install http://phantomjs.org/ and install the phantom node module https://github.com/amir20/phantomjs-node

Here is an example pdf rendering

var phantom = require('phantom'); phantom.create().then(function(ph) { ph.createPage().then(function(page) { page.open("http://www.google.com").then(function(status) { page.render('google.pdf').then(function() { console.log('Page Rendered'); ph.exit(); }); }); }); }); 
+9
source

Source: https://habr.com/ru/post/1486208/


All Articles