From 9e2f8b6231f61cc598b3562d492501768f22fac4 Mon Sep 17 00:00:00 2001 From: benweet Date: Thu, 14 Aug 2014 23:23:39 +0100 Subject: [PATCH] Tweaked wkhtmltopdf parameters --- app/pdf.js | 2 +- public/res/publisher.js | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/pdf.js b/app/pdf.js index f125cfad..f5fb37f7 100644 --- a/app/pdf.js +++ b/app/pdf.js @@ -46,7 +46,7 @@ module.exports = function(req, res, next) { // wkhtmltopdf can't access /dev/stdout on Amazon EC2 for some reason var filePath = '/tmp/' + Date.now() + '.pdf'; - var wkhtmltopdf = spawn('wkhtmltopdf', params.concat('--javascript-delay', '6000', '-', filePath), { + var wkhtmltopdf = spawn('wkhtmltopdf', params.concat('--window-status', 'done', '-', filePath), { stdio: [ 'pipe', 'ignore', diff --git a/public/res/publisher.js b/public/res/publisher.js index ede3c881..4f63f236 100644 --- a/public/res/publisher.js +++ b/public/res/publisher.js @@ -355,11 +355,14 @@ define([ return task.chain(); } monetize.getTokenImmediate(function(err, result) { - token = result || ''; + token = result; task.chain(); }); }); task.onRun(function() { + if(!token) { + return task.chain(); + } var xhr = new XMLHttpRequest(); xhr.open('POST', constants.HTMLTOPDF_URL + '?token=' + encodeURIComponent(token) + '&options=' + encodeURIComponent(settings.pdfOptions), true); xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); @@ -378,9 +381,7 @@ define([ xhr.send(content); }); task.onSuccess(function() { - if(pdf !== undefined) { - utils.saveAs(pdf, fileMgr.currentFile.title + ".pdf"); - } + pdf && utils.saveAs(pdf, fileMgr.currentFile.title + ".pdf"); }); task.enqueue(); });