|
|
|
@@ -45,11 +45,11 @@ function run(libreOfficeBin, cmd, convert) { |
|
|
|
const {_args} = parseCommand(libreOfficeBin, cmd, convert); |
|
|
|
let _cmd = libreOfficeBin; |
|
|
|
|
|
|
|
if (convert === "img") { |
|
|
|
_cmd = "convert"; |
|
|
|
} else if (process.platform === "win32" && convert === "pdf") { |
|
|
|
_cmd = process.env.ComSpec; |
|
|
|
} |
|
|
|
// if (convert === "img") { |
|
|
|
// _cmd = "convert"; |
|
|
|
// } else if (process.platform === "win32" && convert === "pdf") { |
|
|
|
// _cmd = process.env.ComSpec; |
|
|
|
// } |
|
|
|
|
|
|
|
const proc = spawn(_cmd, _args); |
|
|
|
|
|
|
|
@@ -71,6 +71,7 @@ function run(libreOfficeBin, cmd, convert) { |
|
|
|
exports.convert = async ({ |
|
|
|
libreofficeBin, |
|
|
|
libreofficeBins, |
|
|
|
convertBin, |
|
|
|
sourceFile, |
|
|
|
outputDir, |
|
|
|
img, |
|
|
|
@@ -85,7 +86,7 @@ exports.convert = async ({ |
|
|
|
const outputImg = outputFile.replace(/\.pdf$/, `-%d.${imgExt || "png"}`); |
|
|
|
|
|
|
|
const ext = path.extname(sourceFile.toLowerCase()); |
|
|
|
const extensions = [".pdf", ".pptx", ".ppt", ".odp", ".key"]; |
|
|
|
const extensions = [".pdf", ".pptx", ".ppt", ".docx", ".doc", ".xlsx", ".xls", ".odp", ".key"]; |
|
|
|
|
|
|
|
const pdf = [ |
|
|
|
"--headless", |
|
|
|
@@ -147,7 +148,7 @@ exports.convert = async ({ |
|
|
|
if (!img) { |
|
|
|
return pdfRes; |
|
|
|
} else { |
|
|
|
return run(libreofficeBin, image, "img").then((imageRes) => { |
|
|
|
return run(convertBin, image, "img").then((imageRes) => { |
|
|
|
if (imageRes !== "Error") { |
|
|
|
return imageRes; |
|
|
|
} else { |