Have ideas to improve npm?Join in the discussion! »

    tfk-template-to-pdf

    3.0.1 • Public • Published

    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

    Install

    npm i tfk-template-to-pdf

    DownloadsWeekly Downloads

    3

    Version

    3.0.1

    License

    MIT

    Unpacked Size

    33.7 kB

    Total Files

    10

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar
    • avatar