diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php index 4f91157438b..03136a20b63 100644 --- a/htdocs/includes/odtphp/odf.php +++ b/htdocs/includes/odtphp/odf.php @@ -459,7 +459,8 @@ IMG; $name=str_replace('.odt', '', $name); $command = DOL_DOCUMENT_ROOT.'/includes/odtphp/odt2pdf.sh '.$name; - //dol_syslog('$execmethod='.$execmethod.' Run command='.$command); + + dol_syslog(get_class($this).'::exportAsAttachedPDF $execmethod='.$execmethod.' Run command='.$command,LOG_DEBUG); if ($execmethod == 1) { exec($command, $output_arr, $retval); @@ -486,16 +487,16 @@ IMG; if($retval == 0) { - //dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG); + dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG); if (headers_sent($filename, $linenum)) { throw new OdfException("headers already sent ($filename at $linenum)"); } - if (!empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + /*if (!empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { header('Content-type: application/pdf'); header('Content-Disposition: attachment; filename="'.$name.'.pdf"'); readfile("$name.pdf"); - } + }*/ unlink("$name.odt"); } else { //dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG); diff --git a/htdocs/includes/odtphp/odt2pdf.sh b/htdocs/includes/odtphp/odt2pdf.sh index b9710682465..28f9ef32b22 100755 --- a/htdocs/includes/odtphp/odt2pdf.sh +++ b/htdocs/includes/odtphp/odt2pdf.sh @@ -2,21 +2,21 @@ # @copyright GPL License 2010 - Vikas Mahajan - http://vikasmahajan.wordpress.com if [ -f "$1.odt" ] -then -pgrep -U `id -u` soffice -if [ $? -ne 0 ] -then -soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard -sleep 2 -fi -jodconverter "$1.odt" "$1.pdf" -if [ $? -ne 0 ] -then -echo "Error while converting odt to pdf" -exit 1 -fi -sleep 1 -else -echo "Error: Odt file does not exist" -exit 1 + then + pgrep -U `id -u` soffice + if [ $? -ne 0 ] + then + soffice --invisible --accept="socket,host=127.0.0.1,port=8100;urp;" --nofirststartwizard --headless & + sleep 2 + fi + jodconverter "$1.odt" "$1.pdf" + if [ $? -ne 0 ] + then + echo "Error while converting odt to pdf" + exit 1 + fi + sleep 1 + else + echo "Error: Odt file does not exist" + exit 1 fi