@secretboy/pdf

Generate pdf using handlebars template engine.

Usage no npm install needed!

<script type="module">
  import secretboyPdf from 'https://cdn.skypack.dev/@secretboy/pdf';
</script>

README

pdf

v2019.06.05

Generate pdf using handlebars template engine.

Usage

Install the package:

npm install --save @secretboy/pdf

Then use like this:

const sb_pdf = require('@secretboy/pdf')

let pdfRes = await sb_pdf.generate(html, options, pdfOptions, path)

Parameters:

html

  • HTML template in string format.

options

  • Variables to replace in the template. See handlebars templates for more info.

pdfOptions

  • format - String. (default A4)
  • orientation - String. (default portrait)
  • border - String. default(10mm)

path

  • String path for output file.