1.0.1 • Published 7 years ago

phtps v1.0.1

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

phtps

npm CircleCI Codecov dependencies devDependencies

NPM

Sample node http server for pdf generation with phantom-html-to-pdf

For more infomation please see: https://www.npmjs.com/package/phantom-html-to-pdf

Install

npm install phtps

Usage

phtps [path/to/config/file]

Configuration:

Config file as JSON

Default:

{
    "hostname" : "127.0.0.1",
    "port" : 8686,
    "logLevel" : "info",
    "globalOptions" : {
        "numberOfWorkers": 1,
        "strategy": "phantom-server"
    },
    "localOptions" : {
        "waitForJS" : false
    }
}

Example (./example/example.config):

{
    "hostname" : "0.0.0.0",
    "port" : 8686,
    "logLevel" : "debug",
    "globalOptions" : {
        "numberOfWorkers": 2,
        "strategy": "dedicated-process",
        "timeout": 60000
    },
    "localOptions" : {
        "waitForJS" : true // var PHANTOM_HTML_TO_PDF_READY must be set
    }
}
  • hostname, port and logLevel are for http server
  • globalOptions and localOptions are for phantom-html-to-pdf

Global Options: https://www.npmjs.com/package/phantom-html-to-pdf#global-options

Local Options: https://www.npmjs.com/package/phantom-html-to-pdf#local-options

Development

Install: npm install
Test: npm test
Code coverage: npm run coverage
Codecov: npm run codecov
Start: npm start -- example/example.config
Link: npm link