Commit 9249d06c authored by Syretta Man's avatar Syretta Man

modified pdf

parent 7f406004
Pipeline #112948 passed with stages
in 56 seconds
......@@ -93,14 +93,26 @@ public class WebServer {
bw.close();
resp.setContentType("text/markdown");
resp.setHeader("Content-disposition", "attachment; filename=sample.md");
resp.setContentType("application/pdf");
resp.setHeader("Content-disposition", "attachment; filename=sample.pdf");
ProcessBuilder pb = new ProcessBuilder();
String[] cm = {"pandoc", "-s", "-o", "sample.pdf", "sample.md"};
String[] cm = {"pandoc", "-s", "-o", "sample.pdf", "answer.md"};
pb.command(cm);
pb.start();
try (InputStream in = new FileInputStream(file);
OutputStream out = resp.getOutputStream()) {
byte[] buffer = new byte[1048];
int numBytesRead;
while ((numBytesRead = in.read(buffer)) > 0) {
out.write(buffer, 0, numBytesRead);
}
}
file.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