Commit 9c8221b1 authored by Vincent's avatar Vincent
Browse files

Fixes pdf downloading

parent 87d3b4ec
Pipeline #172896 passed with stages
in 13 seconds
......@@ -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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment