Merge pull request #9 from WIHP/master
Added ability to override the arguments
This commit is contained in:
commit
ac6e85b1c2
2 changed files with 18 additions and 9 deletions
|
@ -29,8 +29,8 @@ Then add this line to your project's `grunt.js` gruntfile:
|
||||||
grunt.loadNpmTasks('grunt-wkhtmltopdf');
|
grunt.loadNpmTasks('grunt-wkhtmltopdf');
|
||||||
```
|
```
|
||||||
|
|
||||||
[wkhtmltopdf]: http://code.google.com/p/wkhtmltopdf/
|
[wkhtmltopdf]: http://wkhtmltopdf.org/
|
||||||
[wkhtmltopdf_dl]: http://code.google.com/p/wkhtmltopdf/downloads/list
|
[wkhtmltopdf_dl]: http://wkhtmltopdf.org/downloads.html
|
||||||
[grunt]: https://github.com/gruntjs/grunt
|
[grunt]: https://github.com/gruntjs/grunt
|
||||||
[getting_started]: https://github.com/cowboy/grunt/blob/master/docs/getting_started.md
|
[getting_started]: https://github.com/cowboy/grunt/blob/master/docs/getting_started.md
|
||||||
|
|
||||||
|
|
|
@ -51,15 +51,24 @@ module.exports = function(grunt) {
|
||||||
"Converting " + src + " -> " + dest
|
"Converting " + src + " -> " + dest
|
||||||
);
|
);
|
||||||
|
|
||||||
// Launch PhantomJS.
|
// default args
|
||||||
|
var args = [
|
||||||
|
'--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
|
||||||
|
];
|
||||||
|
|
||||||
|
// overrides the args
|
||||||
|
if (file.args) {
|
||||||
|
args = file.args;
|
||||||
|
}
|
||||||
|
|
||||||
|
// adds the src and dest
|
||||||
|
args = args.concat([src, dest]);
|
||||||
|
|
||||||
|
// Launch wkhtmltopdf.
|
||||||
helper.convert({
|
helper.convert({
|
||||||
code: 90,
|
code: 90,
|
||||||
args: [
|
args: args,
|
||||||
'--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
|
|
||||||
src,
|
|
||||||
dest
|
|
||||||
],
|
|
||||||
done: function(err) {
|
done: function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
grunt.log('>>>', err);
|
grunt.log('>>>', err);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue