Updated README
This commit is contained in:
parent
0b93441169
commit
69a270f604
2 changed files with 51 additions and 14 deletions
53
README.md
53
README.md
|
@ -29,11 +29,6 @@ Then add this line to your project's `grunt.js` gruntfile:
|
||||||
grunt.loadNpmTasks('grunt-wkhtmltopdf');
|
grunt.loadNpmTasks('grunt-wkhtmltopdf');
|
||||||
```
|
```
|
||||||
|
|
||||||
[wkhtmltopdf]: http://wkhtmltopdf.org/
|
|
||||||
[wkhtmltopdf_dl]: http://wkhtmltopdf.org/downloads.html
|
|
||||||
[grunt]: https://github.com/gruntjs/grunt
|
|
||||||
[getting_started]: https://github.com/cowboy/grunt/blob/master/docs/getting_started.md
|
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
Simply add task definition in your gruntfile. See the folllowing example:
|
Simply add task definition in your gruntfile. See the folllowing example:
|
||||||
|
|
||||||
|
@ -54,19 +49,61 @@ Simply add task definition in your gruntfile. See the folllowing example:
|
||||||
|
|
||||||
Run `grunt wkhtmltopdf` to execute all the targets or `grunt wkhtmltopdf:targetname` to execute a specific target. Every `html` file defined by the `src` parameter will be turned into a PDF and saved to `dest` folder.
|
Run `grunt wkhtmltopdf` to execute all the targets or `grunt wkhtmltopdf:targetname` to execute a specific target. Every `html` file defined by the `src` parameter will be turned into a PDF and saved to `dest` folder.
|
||||||
|
|
||||||
|
### Sending arguments to `wkhtml2pdf`
|
||||||
|
|
||||||
|
Arguments sent via the `args` key in the task definition will be forwarded to `wkhtml2pdf` as follow :
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
//...
|
||||||
|
wkhtmltopdf: {
|
||||||
|
prod: {
|
||||||
|
src: 'path/to/some/html/file/*.html',
|
||||||
|
dest: 'pdf/output/',
|
||||||
|
args: [
|
||||||
|
'--dpi', '96',
|
||||||
|
'--print-media-type',
|
||||||
|
'--grayscale'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//...
|
||||||
|
```
|
||||||
|
|
||||||
|
Defining custom arguments will override default ones:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// grunt-wkhtml2pdf default arguments
|
||||||
|
var args = [
|
||||||
|
'--dpi', '96',
|
||||||
|
'--print-media-type'
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
See [wkhtml2pdf documentation][wkhtmltopdf_doc] for available options
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt][grunt].
|
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt][grunt].
|
||||||
|
|
||||||
## Release History
|
## Release History
|
||||||
|
|
||||||
- *v0.1.0*: First Release
|
- *v0.5.0*:
|
||||||
- *v0.2.0*: Fixed compatibility with grunt 0.4
|
- Merged #12 (Fix #11) : Added async support
|
||||||
- *v0.3.0*: grunt-wkhtmltopdf is now a multi-task
|
- Merged #9 : Added ability to override the arguments
|
||||||
- *v0.4.0*:
|
- *v0.4.0*:
|
||||||
- Update project config files to work with Grunt 0.4
|
- Update project config files to work with Grunt 0.4
|
||||||
- Update wkthmltopdf task to use Grunt 0.4 multi-task API
|
- Update wkthmltopdf task to use Grunt 0.4 multi-task API
|
||||||
- Improve predictability of the destination for created PDFs
|
- Improve predictability of the destination for created PDFs
|
||||||
|
- *v0.3.0*: grunt-wkhtmltopdf is now a multi-task
|
||||||
|
- *v0.2.0*: Fixed compatibility with grunt 0.4
|
||||||
|
- *v0.1.0*: First Release
|
||||||
|
|
||||||
## License
|
## License
|
||||||
Copyright (c) 2012 Olivier Audard
|
Copyright (c) 2012 Olivier Audard
|
||||||
Licensed under the MIT license.
|
Licensed under the MIT license.
|
||||||
|
|
||||||
|
|
||||||
|
[wkhtmltopdf]: http://wkhtmltopdf.org/
|
||||||
|
[wkhtmltopdf_dl]: http://wkhtmltopdf.org/downloads.html
|
||||||
|
[wkhtmltopdf_doc]: http://wkhtmltopdf.org/docs.html
|
||||||
|
[grunt]: https://github.com/gruntjs/grunt
|
||||||
|
[getting_started]: https://github.com/cowboy/grunt/blob/master/docs/getting_started.md
|
||||||
|
|
|
@ -60,7 +60,7 @@ module.exports = function(grunt) {
|
||||||
// default args
|
// default args
|
||||||
var args = [
|
var args = [
|
||||||
'--dpi', '96', // workarround to wkhtmltopdf letter-spacing bug (see http://code.google.com/p/wkhtmltopdf/issues/detail?id=72)
|
'--dpi', '96', // workarround to wkhtmltopdf letter-spacing bug (see http://code.google.com/p/wkhtmltopdf/issues/detail?id=72)
|
||||||
'--print-media-type', // Use @print media type
|
'--print-media-type' // Use @print media type
|
||||||
];
|
];
|
||||||
|
|
||||||
// overrides the args
|
// overrides the args
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue