I currently have this command that already works directly from terminal, as I mentioned in the title, but doesn't work it when I use it from my code.
lowriter --invisible --headless --convert-to pdf:writer_pdf_Export --outdir ./assets/public/conv_pdf/ ./assets/public/gen_docx/filename.docx
Here's what my code looks like:
err = srvHelpers.DocxToPdf(
fmt.Sprintf(".%v", strings.Replace(docxOutputPath, "./", "/", -1)),
fmt.Sprintf(".%v", strings.Replace(cmmHelpers.GetConfig("CONVERTED_PDF_OUTPUT_PATH"), "./", "/", -1)),
)
if err != nil {
cmmHelpers.MLogger(fmt.Sprintf("docxToPdf err: %v", err))
}
func DocxToPdf(srcDocxPath string, outputPath string) error{
arg0 := "lowriter"
arg1 := "--invisible --headless"
arg2 := "--convert-to"
arg3 := "pdf:writer_pdf_Export"
arg4 := fmt.Sprintf("--outdir %v", outputPath)
command := fmt.Sprintf("%v %v %v %v %v %v", arg0, arg1, arg2, arg3, arg4, srcDocxPath)
_, err := exec.Command(command).Output()
if(err != nil){
return err
}
return nil
}
When I check my server's logs, I can see this message:
docxToPdf err: fork/exec lowriter --invisible --headless --convert-to pdf:writer_pdf_Export --outdir ./assets/public/conv_pdf/ ./assets/public/gen_docx/vhc_75-71506.docx: no such file or directory
Here's proof that the command works:

no such file or directory.