LibreOffice: rephrase comments (conversion is generic and not PDF-specific)
This commit is contained in:
parent
df5618b274
commit
73d09f1c6c
1 changed files with 7 additions and 3 deletions
|
@ -56,7 +56,10 @@ function doConvertTask(task, callback) {
|
||||||
var tmpDir = os.tmpdir();
|
var tmpDir = os.tmpdir();
|
||||||
|
|
||||||
async.series([
|
async.series([
|
||||||
// Generate a PDF file with LibreOffice
|
/*
|
||||||
|
* use LibreOffice to convert task.srcFile to another format, given in
|
||||||
|
* task.type
|
||||||
|
*/
|
||||||
function(callback) {
|
function(callback) {
|
||||||
var soffice = spawn(settings.soffice, [
|
var soffice = spawn(settings.soffice, [
|
||||||
'--headless',
|
'--headless',
|
||||||
|
@ -81,17 +84,18 @@ function doConvertTask(task, callback) {
|
||||||
stdoutBuffer += data.toString();
|
stdoutBuffer += data.toString();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Throw an exception if libreoffice failed
|
|
||||||
soffice.on('exit', function(code) {
|
soffice.on('exit', function(code) {
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
|
// Throw an exception if libreoffice failed
|
||||||
return callback(`LibreOffice died with exit code ${code} and message: ${stdoutBuffer}`);
|
return callback(`LibreOffice died with exit code ${code} and message: ${stdoutBuffer}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if LibreOffice exited succesfully, go on with processing
|
||||||
callback();
|
callback();
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// Move the PDF file to the correct place
|
// Move the converted file to the correct place
|
||||||
function(callback) {
|
function(callback) {
|
||||||
var filename = path.basename(task.srcFile);
|
var filename = path.basename(task.srcFile);
|
||||||
var pdfFilename = filename.substr(0, filename.lastIndexOf('.')) + '.' + task.type;
|
var pdfFilename = filename.substr(0, filename.lastIndexOf('.')) + '.' + task.type;
|
||||||
|
|
Loading…
Reference in a new issue