Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Wang, Vincent H
simplewebapp
Commits
9c8221b1
Commit
9c8221b1
authored
Jan 24, 2021
by
Vincent
Browse files
Fixes pdf downloading
parent
87d3b4ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/ic/doc/web/PDFResultPage.java
View file @
9c8221b1
...
...
@@ -13,14 +13,21 @@ public class PDFResultPage extends MarkdownResultPage {
@Override
public
void
writeTo
(
HttpServletResponse
resp
)
throws
IOException
{
File
markdown
=
getFile
();
String
currentDir
=
System
.
getProperty
(
"user.dir"
);
ProcessBuilder
pb
=
new
ProcessBuilder
();
pb
.
command
(
"pandoc -s -o result.pdf "
+
markdown
.
getAbsolutePath
());
pb
.
start
();
ProcessBuilder
pb
=
new
ProcessBuilder
(
"pandoc"
,
"-s"
,
"-o"
,
currentDir
+
"/result.pdf"
,
markdown
.
getAbsolutePath
());
Process
p
=
pb
.
start
();
try
{
p
.
waitFor
();
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
System
.
out
.
println
(
System
.
getProperty
(
"user.dir"
));
File
pdf
=
new
File
(
"
result.pdf"
);
File
pdf
=
new
File
(
currentDir
+
"/
result.pdf"
);
outputStreams
(
markdown
,
resp
);
outputStreams
(
pdf
,
resp
);
// Remove temporary file
markdown
.
delete
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment