pdfpy

2.0.20 • Public • Published

HTML to PDF

Build Status npm version

Convert HTML to PDF simple and fast

sudo npm install pdfpy

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Installing

A step by step series of examples that tell you have to get a development env running

Install latest node and npm

Nodejs

Dependency

  • Python
  • pdfkit
  • simplejson

Require

var pdfpy = require('pdfpy');

Types (file and url)

//To generate pdf from file
pdfpy.file()
//To generate pdf from url
pdfpy.url()

Example

File

var pdfpy = require('pdfpy');
 
var data = {
    //the key as to be same as below
    input: "./test.html",
    output: "./output.pdf"
}
pdfpy.file(data, function(err, res) {
    if(err) throw err
 
    if(res) console.log("success")
});

URL

var pdfpy = require('pdfpy');
 
var data = {
    //the key as to be same as below
    input: "http://google.com",
    output: "./output.pdf"
}
pdfpy.url(data, function(err, res) {
    if(err) throw err
 
    if(res) console.log("success")
});

Using Options

var pdfpy = require('pdfpy');
 
var data = {
    //the key as to be same as below
    input: "./test.html",
    output: "./output.pdf",
    options: {
        'page-size': 'Letter',
        'margin-top': '0.75in',
        'margin-right': '0.75in',
        'margin-bottom': '0.75in',
        'margin-left': '0.75in',
    }
}
 
pdfpy.file(data, function(err, res) {
    if(err) throw err
 
    if(res) console.log("success")
});
 

Running the tests

npm test

Built With

pdfkit 0.6.1 python package

Authors

KiKe

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.20
    0
    • latest

Version History

Package Sidebar

Install

npm i pdfpy

Weekly Downloads

0

Version

2.0.20

License

MIT

Last publish

Collaborators

  • keerthiniranjan
  • kiranniranjan