Tweaked wkhtmltopdf parameters
This commit is contained in:
parent
149d3ec89d
commit
9e2f8b6231
@ -46,7 +46,7 @@ module.exports = function(req, res, next) {
|
|||||||
|
|
||||||
// wkhtmltopdf can't access /dev/stdout on Amazon EC2 for some reason
|
// wkhtmltopdf can't access /dev/stdout on Amazon EC2 for some reason
|
||||||
var filePath = '/tmp/' + Date.now() + '.pdf';
|
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: [
|
stdio: [
|
||||||
'pipe',
|
'pipe',
|
||||||
'ignore',
|
'ignore',
|
||||||
|
@ -355,11 +355,14 @@ define([
|
|||||||
return task.chain();
|
return task.chain();
|
||||||
}
|
}
|
||||||
monetize.getTokenImmediate(function(err, result) {
|
monetize.getTokenImmediate(function(err, result) {
|
||||||
token = result || '';
|
token = result;
|
||||||
task.chain();
|
task.chain();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
task.onRun(function() {
|
task.onRun(function() {
|
||||||
|
if(!token) {
|
||||||
|
return task.chain();
|
||||||
|
}
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open('POST', constants.HTMLTOPDF_URL + '?token=' + encodeURIComponent(token) + '&options=' + encodeURIComponent(settings.pdfOptions), true);
|
xhr.open('POST', constants.HTMLTOPDF_URL + '?token=' + encodeURIComponent(token) + '&options=' + encodeURIComponent(settings.pdfOptions), true);
|
||||||
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
||||||
@ -378,9 +381,7 @@ define([
|
|||||||
xhr.send(content);
|
xhr.send(content);
|
||||||
});
|
});
|
||||||
task.onSuccess(function() {
|
task.onSuccess(function() {
|
||||||
if(pdf !== undefined) {
|
pdf && utils.saveAs(pdf, fileMgr.currentFile.title + ".pdf");
|
||||||
utils.saveAs(pdf, fileMgr.currentFile.title + ".pdf");
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
task.enqueue();
|
task.enqueue();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user