Commit 4de544c5 authored by Syretta Man's avatar Syretta Man

add try catch

parent b4a09549
Pipeline #113014 passed with stages
in 51 seconds
......@@ -94,13 +94,19 @@ public class WebServer {
bw.close();
resp.setContentType("application/pdf");
resp.setHeader("Content-disposition", "attachment; filename=haha.pdf");
resp.setHeader("Content-disposition", "attachment; filename=anything.pdf");
String path = file.getAbsolutePath();
ProcessBuilder pb = new ProcessBuilder("bash", "-c", "pandoc -s -o answer.pdf " + path);
// String[] cm = {"pandoc", "-s", "-o", "sample.pdf", "answer.md"};
// pb.command(cm);
pb.start();
Process process = pb.start();
try {
process.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
try (InputStream in = new FileInputStream("answer.pdf");
OutputStream out = resp.getOutputStream()) {
......
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