Here is the code:
Code:
public static void parsePage1(String[][] tab)
throws IOException
{
Runtime myRuntime = Runtime.getRuntime();
Process myProcess;
File file = new File("C:\\" );
for(int i=0; i<tab.length; i++)
{
file = new File("SOURCE_PATH\\"+tab[i][0]+"_"+tab[i][1]+"_"+tab[i][2]+"_"+tab[i][3]+".pdf" );
myProcess = myRuntime.exec("java -jar \"C:\\Program Files\\pdfsam\\lib\\pdfsam-console-0.7.3.jar\" -f \""+file.getPath()+"\" -o DESTINATION_PATH -s BURST -compressed split" );
try
{
myProcess.waitFor();
}
catch (InterruptedException ie)
{
ie.printStackTrace();
}
file.delete();
file = new File("DESTINATION_PATH\\1_"+tab[i][0]+"_"+tab[i][1]+"_"+tab[i][2]+"_"+tab[i][3]+".pdf" );
file.renameTo(new File("DESTINATION_PATH\\"+tab[i][0]+"_"+tab[i][1]+"_"+tab[i][2]+"_"+tab[i][3]+".pdf" ));
file = new File("DESTINATION_PATH\\2_"+tab[i][0]+"_"+tab[i][1]+"_"+tab[i][2]+"_"+tab[i][3]+".pdf" );
file.delete();
myProcess.destroy();
}
}
Bookmarks