1.0.0 • Published 8 years ago

phantom-promised v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

Phantom Promised

A dead simple html to pdf lib/webservice

Usage

You can import the module

  const phantom = require('phantom-promised');
  phantom('<div>Hello World</div>', { format: 'A4', orientation: 'portrait', margin: '0' })
    // pdf is a buffer containing the PDF
    .then(pdf => ...);

Or simply run the bundled server and send POST request with as body parameter html

PORT=8080 npm start

then using httpie for example

http POST 0:8080 "html=<div>Hello World</div>" > out.pdf