apilayer / html2pdf.it

Webservice for generating pdfs from html
html2pdf.it
549 stars 157 forks source link

Integrate it to a Node.JS or Sails.JS app #42

Closed alexventuraio closed 7 years ago

alexventuraio commented 8 years ago

Hi there! First of all, I must to tell you CONGRATULATIONS for such amazing project. I'm developing a Sails.JS application but also I use to use Node.JS. In both cases I need to generate some PDF files to send and email with the registration form attached.

I was searching for some examples and the best one for me is this one. So, I would like to know how to integrate or embed this amazing tool in my Sails or Node js app?

Or I just can fork the project and deploy it to Heroku to have my own html2pdf server? I hope you could help me out.

Thanks in advance!

edm00se commented 7 years ago

I would recommend you run html2pdf.it as its own application. It should make it easier to upgrade and maintain or operate, separate of any other application code.

To deploy it to heroku, I would recommend following their getting started with node guide. You'll probably wish to fork the project into your own copy, so you can add a Procfile to the root of the application, with the contents of:

web: node ./lib/app.js

Per heroku's documentation on Procfiles, this is what's required for their platform to recognize the command to run on startup; it should install the dependencies as identified in the app's package.json, so no further config should be necessary.