niklaslind / pdfgenerator

Post HTML get PDF back

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About

PDFGenerator används för att omvandla HTML till PDF. Den använder komponenten wkhtmltopdf för att generera PDF.

Usage

  1. Generate PDF POST html-data http:///pdf return: {pdfurl: /pdf/}

  2. Get PDF GET http:///pdf/ return: pdf-document

Generated PDF-document will be available for 1 minute.

Why not just send the PDF as response in step 1)? Because the browser will not open the PDF-content as response from POST, only from GET.

Start application

Develpment: npm install node server.js

Production: npm install forever server.js

Test

Starta server lokalt: node server.js

cd test ./test.sh

Detta script skickar 20 parallella requests till localhost:8080/pdf och hämtar hem och öppnar PDF:erna.

Beroenden

Nodejs: http://nodejs.org/ wkhtmltopdf: http://wkhtmltopdf.org/

Installation

See Vagrant-file (vagrant/Vagrantfile) for example installation:

npm install -g forever

About

Post HTML get PDF back


Languages

Language:Ruby 51.1%Language:JavaScript 45.5%Language:Shell 3.4%