Forum OpenACS Development: Re: JODconverter vs. OpenOffice/LibreOffice Command Line

Collapse
Posted by Malte Sussdorff on
Hi Antonio,

How do you call libreoffice? If I try to call libreoffice directly using exec, I have a problem with the PATH missing.

[Java framework] Error in function createSettingsDocument (elements.cxx).
javaldx failed!
Warning: failed to read path from javaldx
while executing
"exec /usr/bin/libreoffice --headless --convert-to pdf --outdir /var/lib/aolserver/ ..."
invoked from within
"ns_proxy eval $handle "exec $call""

Curious how you call it and if you might have a wrapper function for it. I tried:

exec /usr/bin/libreoffice --headless --convert-to $convert_to --outdir $outdir $oo_file

Collapse
Posted by Malte Sussdorff on
Solved my own problem using google and looking for a PHP solution instead of TCL, which taught me that the HOME env was missing....

exec -- /usr/bin/env HOME=[acs_root_dir] /usr/bin/libreoffice --headless --convert-to $convert_to --outdir $outdir $oo_file

Collapse
Posted by Antonio Pisano on
Yep, more or less the same thing I came up with. The problem is Libreoffice needs to write stuff in its home directory, therefore this must be set to something you have write permissions into.

Kudos for solving! :-)

Collapse
Posted by Frank Bergmann on
We've got the oofice call in /packages/intranet-invoices/www/view.tcl, for example. That looks like this:

set result [im_exec bash -l -c "export HOME=~\$\{whoami\}; ooffice --headless --convert-to pdf --outdir /tmp/ $odt_zip"]

Cheers,
Frank