I am trying to produce a pdf-output. I finished already the pdf-file with pdfbox, but it has now around 15 MB. This is to large for the planned purpose. So I want to reduce the file size. I tried it first with linux terminal and ghostscript:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=4 -dNOPAUSE -dBATCH -r150 -sOutputFile=output.pdf input.pdf
This works fine. But since it is a java program and should work without shell, I tested ghost4j:
Ghostscript gs = Ghostscript.getInstance();
String[] gsArgs = new String[7];
gsArgs[0] = "-sDEVICE=pdfwrite ";
gsArgs[1] = "-dCompatibilityLevel=1.4 ";
gsArgs[2] = "-dPDFSETTINGS=/screen ";
gsArgs[3] = "-dNOPAUSE ";
gsArgs[4] = "-dBATCH ";
gsArgs[5] = "-sOutputFile=qw3.pdf ";
gsArgs[6] = "input.pdf";
gs.initialize(gsArgs);
gs.exit();
But I am getting no output file. Are some of this arguments illegal?
Hope, somebody can help.