For some reasons, I couldn't install wkhtmltopdf directly on my system, I am trying to install an wkhtmltopdf docker instead, I have tried Surnet/docker-wkhtmltopdf. I also writing an API in spring boot to convert html to pdf file. Whenever I need to convert a html file to a pdf file, I have to run a command like this.
File tempFolder = new File("path/to/tempFolder");
File tempHtmlFile = new File(tempFolder, "input.html");
File tempPdfFile = new File(tempFolder, "output.pdf");
List<String> command = new ArrayList<>();
command.add("docker");
command.add("run");
command.add("--rm");
command.add("-v");
command.add(tempFolder.getAbsolutePath() + ":/data");
command.add("surnet/docker-alpine-wkhtmltopdf");
command.add("/data/" + tempHtmlFile.getName());
command.add("-");
command.add(">");
command.add(tempPdfFile.getAbsolutePath());
ProcessBuilder processBuilder = new ProcessBuilder(command);
Every time I run the above command, it creates a container and then exits. I want to know how can I create a container that I can run my spring boot application and the wkhtmltopdf docker, and use a simple command like wkhtmltopdf input.html output.html (which is like the command from https://wkhtmltopdf.org/) Also, Is there any different wkhtmltopdf docker that I can do like that, or any maven dependencies that I can use to convert html to pdf.