I'm trying to integrate pdf2img in java code, using java.lang.Runtime.exec()
Runtime run = Runtime.getRuntime();
Process p = null;
try
{
p = run.exec("\"C:\\Program Files\\VeryPDF PDF2Image v2.1\\pdf2img.exe\" -m -i C:\\test.pdf -o C:\\test.pdf.tif");
int salida = p.waitFor();
System.out.println("exitValue: " + salida);
}
catch (Exception e)
{
e.printStackTrace();
}
It seems to work; i get the tiff output and an exit value of 0 (By convention, 0 indicates normal termination)
But! - if I provoke an error - specifying a non exitsting directory, I also get exit value 0 (and an empty tiff-file.!)
I have also invoked VeryDOC doc2any the same way, and it returns 1 meening succes and 0 when an error occurred.
Can you help me how to detect errors using pdf2img?
==================================
We apologize for any inconvenience this may have caused to you, maybe this is a problem in the current version of pdf2img.exe application , we will research this problem shortly.
Additionally, I suggest you may simple check the input PDF file before you deliver it to pdf2img.exe application, if input PDF file is not exist, you needn’t call pdf2img.exe application for conversion, this can be done easily, is this solution okay to you?