Comparing version 0.1.0 to 0.1.1
@@ -49,3 +49,3 @@ var fs, path, phantomjs, script, spawn; | ||
if (isFile = /^\%PDF/.test(file.slice(0, 4).toString())) { | ||
return callback(void 0, file); | ||
return callback(null, file); | ||
} else { | ||
@@ -52,0 +52,0 @@ filename = file.toString(); |
{ | ||
"name": "html-pdf", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "HTML to PDF converter that uses phantomjs", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# node-html-pdf | ||
## a HTML to PDF converter for node.js | ||
## a HTML to PDF converter that wraps phantomjs | ||
![image](http://public.admintools.ch/gh/html-pdf/businesscard.png) | ||
@@ -19,1 +19,20 @@ [Example Business Card](http://public.admintools.ch/gh/html-pdf/businesscard.pdf) | ||
``` | ||
## API | ||
Currently there is only one function | ||
```javascript | ||
var pdf = require('html-pdf'); | ||
var callback = function(err, buffer){} | ||
pdf.create(htmlString, options, callback) | ||
``` | ||
## 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' | ||
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. | ||
Documentation will follow soon. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38
12048
10