3.0.1 • Published 7 years ago

tfk-template-to-pdf v3.0.1

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

Build Status js-standard-style

tfk-template-to-pdf

This is a convenience module for creating pdf documents from templates by using a service like pdftemplater-webservice-docker

Installation

From npm

$ npm install tfk-template-to-pdf

From GitHub

$ git clone git@github.com:telemark/tfk-template-to-pdf.git

cd into folder and run setup

$ npm run setup

Usage

Pass in an options object.

templateData key:value for data to render with template templateFilepath: path to .docx template documentFilepath: where to save the rendered document pdfServiceUrl: URL to pdf converter service

const createPdfFromTemplate = require('tfk-template-to-pdf')
const options = {
  templateData: {
    'title': 'My title is none of your concerns',
    'description': 'Describe me as your best friend',
    'body': 'My body is beautiful'
  },
  templateFilepath: 'test/data/template.docx',
  documentFilepath: 'test/data/document.pdf',
  pdfServiceUrl: 'http://192.168.99.100:3000'
}

createPdfFromTemplate(options, (error, data) => {
  if (error) {
    console.error(error)
  } else {
   console.log(data)
  }
})

License

MIT

3.0.1

7 years ago

3.0.0

8 years ago

2.0.9

8 years ago

2.0.8

8 years ago

2.0.7

8 years ago

2.0.6

9 years ago

2.0.5

9 years ago

2.0.4

9 years ago

2.0.3

9 years ago

2.0.2

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.1.0

10 years ago