From 5b29b57245b5c1f12a00d9f8600298c07632bce2 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Thu, 4 Sep 2014 11:05:03 -0400 Subject: [PATCH 1/2] Added ability to override the arguments I needed to be able to use a different set of arguments. Updated to allow for the args to be passed in the same way the src and dest are. Could improve by comparing the two arrays instead of simply overriding them. --- tasks/wkhtmltopdf.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/tasks/wkhtmltopdf.js b/tasks/wkhtmltopdf.js index 6f6dc05..8fb4def 100644 --- a/tasks/wkhtmltopdf.js +++ b/tasks/wkhtmltopdf.js @@ -51,15 +51,24 @@ module.exports = function(grunt) { "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({ code: 90, - 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 - ], + args: args, done: function(err) { if (err) { grunt.log('>>>', err); From b21de20c739b44ade9d446d060a4f2f28db54a86 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Mon, 8 Dec 2014 14:54:53 -0500 Subject: [PATCH 2/2] Update README.md Updated links for wkhtmltopdf as the project has moved --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0eeeaed..3cca3a4 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ Then add this line to your project's `grunt.js` gruntfile: grunt.loadNpmTasks('grunt-wkhtmltopdf'); ``` -[wkhtmltopdf]: http://code.google.com/p/wkhtmltopdf/ -[wkhtmltopdf_dl]: http://code.google.com/p/wkhtmltopdf/downloads/list +[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