Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
ofbiz-directcontrolservlet
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
34197e77
authored
2014-11-12 14:54:05 -0600
by
Ean Schuessler
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
#4364 use string builder
1 parent
01f33936
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
src/com/brainfood/ofbiz/LibreOfficeRenderer.java
src/com/brainfood/ofbiz/LibreOfficeRenderer.java
View file @
34197e7
...
...
@@ -35,7 +35,7 @@ public class LibreOfficeRenderer {
context
.
put
(
"Linux_X86_64"
,
"$Linux_X86_64"
);
context
.
put
(
"Build"
,
"$Build"
);
String
output
=
""
;
String
Builder
output
=
new
StringBuilder
()
;
int
idx
=
0
;
while
(
idx
<
template
.
length
())
{
...
...
@@ -44,12 +44,12 @@ public class LibreOfficeRenderer {
String
tmplChunk
=
template
.
substring
(
idx
,
idx
+
chunkLength
);
SimpleTemplateEngine
engine
=
new
SimpleTemplateEngine
();
Writable
stTemplate
=
engine
.
createTemplate
(
tmplChunk
).
make
(
context
);
output
+=
stTemplate
.
toString
(
);
output
.
append
(
stTemplate
.
toString
()
);
idx
+=
chunkLength
;
}
File
outputFile
=
File
.
createTempFile
(
"bfdcs-"
,
"-tmpl"
);
UtilIO
.
writeString
(
outputFile
,
output
);
UtilIO
.
writeString
(
outputFile
,
output
.
toString
()
);
List
<
String
>
args
=
Arrays
.
asList
(
new
String
[]{
"libreoffice"
,
"--headless"
,
"--convert-to"
,
"pdf"
,
outputFile
.
getPath
(),
"--outdir"
,
"/tmp"
});
ProcessBuilder
pb
=
new
ProcessBuilder
(
args
);
...
...
Please
register
or
sign in
to post a comment