JSPM

pdf-maker

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q42829F
  • License MIT

easy pdf generation using phantom.js

Package Exports

  • pdf-maker

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pdf-maker) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

pdf-maker

An easy way to generate pdf files from ejs templates or html files

##Install

npm i --save pdf-maker

##Usage

##For generating pdf from ejs templates

var pdfMaker = require('pdf-maker');

var template = 'path/to/ejsTemplate.ejs';
var data = {
    name: 'node.js'
};
var pdfPath = '/path/of/pdf/file.pdf';
var option = {
    {
        paperSize: {
            format: 'A4',
            orientation: 'portrait',
            border: '1.8cm'
        }
    };
};

pdfMaker(template, data, pdfPath, option);

Here, 'option' parameter is optional. 'data' is the data which will be used in the ejs template. 'pdfPath' is the path with where the pdf file will be saved.

##For generating pdf from html files.

var pdfMaker = require('pdf-maker');

var template = 'path/to/htmlFile.html';
var pdfPath = '/path/of/pdf/file.pdf';
var option = {
    {
        paperSize: {
            format: 'A4',
            orientation: 'portrait',
            border: '1.8cm'
        }
    };
};

pdfMaker(template, pdfPath, option);

##Roadmap

Adding test cases. Removing external dependencies.