Commit f6004a39 authored by tianyi's avatar tianyi
Browse files

pdf use different names

parent 1a51bade
Pipeline #63527 canceled with stages
......@@ -21,12 +21,12 @@ public class PdfCreator implements Page {
OutputStream writer = resp.getOutputStream();
File markdown = toMarkDown(answer, query);
// turn markdown to a pdf using pandoc
ProcessBuilder pb = new ProcessBuilder("pandoc",markdown.getName() , "-o","result.pdf");
ProcessBuilder pb = new ProcessBuilder("pandoc",markdown.getName() , "-o",query + ".pdf");
File dir = new File("/tmp");
pb.directory(dir);
Process process = pb.start();
process.waitFor();
File pdf = new File("/tmp/result.pdf");
File pdf = new File("/tmp/"+query+".pdf");
writer.write(new FileInputStream(pdf).readAllBytes());
writer.close();
markdown.delete();
......
......@@ -13,7 +13,7 @@ import java.io.IOException;
public class WebServer {
public WebServer() throws Exception {
Server server = new Server(Integer.valueOf(System.getenv("PORT")));
Server server = new Server(5000);//Integer.valueOf(System.getenv("PORT")));
ServletHandler handler = new ServletHandler();
handler.addServletWithMapping(new ServletHolder(new Website()), "/*");
......
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