Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

html-pdf

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-pdf - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

7

Changelog.md

@@ -0,1 +1,8 @@

0.2.1
=====
- Support <script></script> in html head. It will be included in head, body & footer of a page.
- Parse options.timeout. You can now pass a string.
- Improved options documentation
0.2.0

@@ -2,0 +9,0 @@ =====

2

lib/index.js

@@ -31,3 +31,3 @@ var fs, path, phantomjs, script, spawn;

}
}, options.timeout || 10000);
}, parseInt(options.timeout) || 10000);
child.stdout.on('data', function(buffer) {

@@ -34,0 +34,0 @@ return stdout.push(buffer);

{
"name": "html-pdf",
"version": "0.2.0",
"version": "0.2.1",
"description": "HTML to PDF converter that uses phantomjs",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -29,10 +29,42 @@ # node-html-pdf

## Options
`script`: Absolute path to a custom phantomjs script, use the file in lib/scripts as example
`timeout`: Timeout that will cancel phantomjs, milliseconds as Integer, default: 10000
`filename`: The file path of the file that will be written. If you want to save the file permanently, you have to pass this option.
`directory`: The directory path of the file that will be written. default: '/tmp'
```javascript
config = {
// Script options
script: '/url' // Absolute path to a custom phantomjs script, use the file in lib/scripts as example
timeout: 10000 // Timeout that will cancel phantomjs, in milliseconds
// Papersize Options: http://phantomjs.org/api/webpage/property/paper-size.html
"height": "", // allowed units: mm, cm, in, px
"width": "", // allowed units: mm, cm, in, px
- or -
"format": "A4", // allowed units: A3, A4, A5, Legal, Letter, Tabloid
"orientation": "portrait", // portrait or landscape
// Page options
"border": "0" // default is 0, units: mm, cm, in, px
"header": {
"height": "45mm",
"contents": '<div style="text-align: center;">Author: Marc Bachmann</div>'
},
"footer": {
"height": "28mm",
"contents": '<span style="color: #444;">{{page}}</span>/<span>{{pages}}</span>'
},
// File options
"type": "pdf", // allowed file types: png, jpeg, pdf
"quality": "75", // only used for types png & jpeg
// Export options
"buffer": true, // only supported on certain systems
- or -
"filename": "/tmp/html-pdf-123-123.pdf" // The file path of the file that will be written. If you want to save the file permanently, you have to pass this option.
"directory": "/tmp" // The directory the file gets written into if no filename is defined. default: '/tmp'
}
```
The full options object gets converted to JSON and will get passed to the phantomjs script as third argument.
There are more options concerning the paperSize, header & footer options inside the phantomjs script.
## documentations for more available options will follow soon :)
There are more options concerning the paperSize, header & footer options inside the phantomjs script.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc