Tweaked wkhtmltopdf parameters

This commit is contained in:
benweet 2014-08-14 23:23:39 +01:00
parent 149d3ec89d
commit 9e2f8b6231
2 changed files with 6 additions and 5 deletions

View File

@ -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',

View File

@ -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();
});