Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
4781707f
Commit
4781707f
authored
Feb 22, 2015
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Fix jodconverter can't work without the wrapper jodconverter.
parent
2bc6ac46
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/includes/odtphp/odf.php
+9
-6
9 additions, 6 deletions
htdocs/includes/odtphp/odf.php
scripts/odt2pdf/odt2pdf.sh
+29
-20
29 additions, 20 deletions
scripts/odt2pdf/odt2pdf.sh
with
38 additions
and
26 deletions
htdocs/includes/odtphp/odf.php
+
9
−
6
View file @
4781707f
...
@@ -486,11 +486,14 @@ IMG;
...
@@ -486,11 +486,14 @@ IMG;
$execmethod
=
(
empty
(
$conf
->
global
->
MAIN_EXEC_USE_POPEN
)
?
1
:
2
);
// 1 or 2
$execmethod
=
(
empty
(
$conf
->
global
->
MAIN_EXEC_USE_POPEN
)
?
1
:
2
);
// 1 or 2
$name
=
str_replace
(
'.odt'
,
''
,
$name
);
$name
=
preg_replace
(
'/\.odt/i'
,
''
,
$name
);
if
(
!
empty
(
$conf
->
global
->
MAIN_DOL_SCRIPTS_ROOT
))
{
if
(
!
empty
(
$conf
->
global
->
MAIN_DOL_SCRIPTS_ROOT
))
$command
=
$conf
->
global
->
MAIN_DOL_SCRIPTS_ROOT
.
'/scripts/odt2pdf/odt2pdf.sh '
.
$name
;
{
}
else
{
$command
=
$conf
->
global
->
MAIN_DOL_SCRIPTS_ROOT
.
'/scripts/odt2pdf/odt2pdf.sh '
.
$name
.
' '
.
(
is_numeric
(
$conf
->
global
->
MAIN_ODT_AS_PDF
)
?
'jodconverter'
:
$conf
->
global
->
MAIN_ODT_AS_PDF
);
$command
=
'../../scripts/odt2pdf/odt2pdf.sh '
.
$name
;
}
else
{
$command
=
'../../scripts/odt2pdf/odt2pdf.sh '
.
$name
.
' '
.
(
is_numeric
(
$conf
->
global
->
MAIN_ODT_AS_PDF
)
?
'jodconverter'
:
$conf
->
global
->
MAIN_ODT_AS_PDF
);
}
}
...
...
This diff is collapsed.
Click to expand it.
scripts/odt2pdf/odt2pdf.sh
+
29
−
20
View file @
4781707f
#!/bin/bash
#!/bin/bash
# @copyright GPL License 2010 - Vikas Mahajan - http://vikasmahajan.wordpress.com
# @copyright GPL License 2010 - Vikas Mahajan - http://vikasmahajan.wordpress.com
# @copyright GPL License 2013 - Florian HEnry - florian.henry@open-concept.pro
# @copyright GPL License 2013 - Florian HEnry - florian.henry@open-concept.pro
# @copyright GPL License 2015 - Laurent Destailleur - eldy@users.sourceforge.net
#
#
# Convert an ODT into a PDF using "jodconverter" tool.
# Convert an ODT into a PDF using "jodconverter" or "pyodconverter" tool.
# Dolibarr variable MAIN_ODT_AS_PDF must be defined to have this script called after ODT generation.
# Dolibarr variable MAIN_ODT_AS_PDF must be defined to value "jodconverter" to call jodconverter wrapper after ODT generation
# or value "pyodconverter" to call DocumentConverter.py after ODT generation.
# or value "/pathto/jodconverter-cli-file.jar" to call jodconverter java tool without wrapper after ODT generation.
# Dolibarr variable MAIN_DOL_SCRIPTS_ROOT must be defined to path of script directories (otherwise dolibarr will try to guess).
# Dolibarr variable MAIN_DOL_SCRIPTS_ROOT must be defined to path of script directories (otherwise dolibarr will try to guess).
#if [ -f "$1.odt" ]
if
[
"x
$1
"
==
"x"
]
# then
then
# soffice --invisible --convert-to pdf:writer_pdf_Export --outdir $2 "$1.odt"
echo
"Usage: odt2pdf.sh fullfilename [jodconverter|pyodconverter|pathtojodconverterjar]"
# retcode=$?
echo
"Example: odt2pdf.sh myfile ~/jodconverter/jodconverter-cli-2.2.2.jar"
# if [ $retcode -ne 0 ]
exit
# then
fi
# echo "Error while converting odt to pdf: $retcode";
# exit 1
# fi
# else
# echo "Error: Odt file does not exist"
# exit 1
#fi
if
[
-f
"
$1
.odt"
]
if
[
-f
"
$1
.odt"
]
then
then
nbprocess
=
$(
pgrep
-c
soffice
)
nbprocess
=
$(
pgrep
-c
soffice
)
if
[
$nbprocess
-ne
1
]
if
[
$nbprocess
-ne
1
]
# If there is some soffice process running
then
then
soffice
--invisible
--accept
=
"socket,host=127.0.0.1,port=8100;urp;"
--nofirststartwizard
--headless
&
soffice
--invisible
--accept
=
"socket,host=127.0.0.1,port=8100;urp;"
--nofirststartwizard
--headless
&
retcode
=
$?
retcode
=
$?
...
@@ -35,7 +32,19 @@ if [ -f "$1.odt" ]
...
@@ -35,7 +32,19 @@ if [ -f "$1.odt" ]
fi
fi
sleep
2
sleep
2
fi
fi
if
[
"x
$2
"
==
"xjodconverter"
]
then
jodconverter
"
$1
.odt"
"
$1
.pdf"
jodconverter
"
$1
.odt"
"
$1
.pdf"
else
if
[
"x
$2
"
==
"xpyodconverter"
]
then
python DocumentConverter.py
"
$1
.odt"
"
$1
.pdf"
else
java
-jar
$2
"
$1
.odt"
"
$1
.pdf"
fi
fi
retcode
=
$?
retcode
=
$?
if
[
$retcode
-ne
0
]
if
[
$retcode
-ne
0
]
then
then
...
@@ -44,6 +53,6 @@ if [ -f "$1.odt" ]
...
@@ -44,6 +53,6 @@ if [ -f "$1.odt" ]
fi
fi
sleep
1
sleep
1
else
else
echo
"Error: Odt file does not exist"
echo
"Error: Odt file
$1
.odt
does not exist"
exit
1
exit
1
fi
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment