wkhtmltopdf fails, when using --footer arg if executed programmatically

247 Views Asked by At

This question is similiar to wkhtmltopdf fails with --footer-center argument. But the way of running wkhtmltopdf is different.

Im using:

wkhtmltopdf 0.12.2.2 (with patched qt)

on Windows 7 / 64 Bit

When I use the following command in console:

wkhtmltopdf --print-media-type --footer-center [page] "test.html" "test.pdf"

everything runs like expected. But when I do the same programmatically from Java, like:

 List<String> command = new ArrayList<String>();
 command.add("wkhtmltopdf.exe");
 command.add("--footer-center [page]");   
 command.add("--print-media-type");
 command.add(htmlFilename);
 command.add(pdfFilename);
 ProcessBuilder builder = new ProcessBuilder(command);
 ...

the pdf gets not created. When I omit the line (commenting out)

command.add("--footer-center [page]"); 

everything runs as expected.. so the problem deals with that argument for wkhtmltopdf..

Does anyone know how to resolve this issue ?

0

There are 0 best solutions below