1.0.4 • Published 4 years ago

gendocio v1.0.4

Weekly downloads
11
License
ISC
Repository
github
Last release
4 years ago

Gendoc.io - Javascript SDK

PDF document generator API

To use with www.gendoc.io

More information at:

How to use

The API is quite simple to use. Just issue a call to gendoc.generate with the following parameters (template, data, token).

  • Template is the HTML template with Handlbars placeholders, which you will use to create your PDF
  • Data is the JSON data used to fill in the template placeholders (see example below)
  • Token is an API token, which you can get at https://app.gendoc.io, and will avoid you hitting rate limits.

This function returns a promise, which can either resolve with a HTTP payload, where data is the base64 encoded version of the generated PDF. Or, it can raise an error.

Example: Generate a simple PDF

  const gendoc = require('gendocio')
  const fs = require('fs');

  gendoc.generate(
    '<html><body>{{a}}</body></html>', 
    {"a": 2}, 
    ''
  )
  .then((result)=>{
    let buff = new Buffer(result.data, 'base64');
    fs.writeFileSync('out.pdf', buff);
    })
  .catch((result) => console.log(result.data))
1.0.4

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago