Fix odt as PDF generation
This commit is contained in:
parent
d6514e1cd6
commit
e6f9c567d9
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user