I'm converting a doc to a pdf (unoconv) in memory and printing (pdftotext) in the terminal with:
unoconv -f pdf --stdout sample.doc | pdftotext -layout -enc UTF-8 - out.txt
Is working. Now i want use this command with child_process.spawn
:
let filePath = "...",
process = child_process.spawn("unoconv", [
"-f",
"pdf",
"--stdout",
filePath,
"|",
"pdftotext",
"-layout",
"-enc",
"UTF-8",
"-",
"-"
]);
In this case, only the first command (before the |) is working. Is i possible to do what i'm trying?
Thanks.
UPDATE-
Result of: sh -c- ....
bash-3.2$ sh -c- unoconv -f pdf --stdout /Users/fatimaalves/DEV/xx/_input/sample.doc | pdftotext -layout -enc UTF-8 - -
sh: --: invalid option
Usage: sh [GNU long option] [option] ...
sh [GNU long option] [option] script-file ...
GNU long options:
--debug
--debugger
--dump-po-strings
--dump-strings
--help
--init-file
--login
--noediting
--noprofile
--norc
--posix
--protected
--rcfile
--restricted
--verbose
--version
--wordexp
Shell options:
-irsD or -c command or -O shopt_option (invocation only)
-abefhkmnptuvxBCHP or -o option
Syntax Warning: May not be a PDF file (continuing anyway)
Syntax Error: Couldn't find trailer dictionary
Syntax Error: Couldn't find trailer dictionary
Syntax Error: Couldn't read xref table
sh -c-
. It'ssh -c
. – Algie