im not that good in Java but because of the fact, that Talend Studio doesnt support PDF-splitting and merging I had to search of another solution.
To explain my situation:
The task here is to split a PDF with n-pages into n-PDF files. (One for each page). After that, I need to merge each of there PDF-Files with another Fixed PDF. (creating Letters with individual beginnings and fixed followings)
The PDF, i want to split, is automatically created in Talend using "TJasperReportExec" with a concrete Template which isnt supporting (afaik) the splitting of PDF-Files as well.
After some research i found that Code:
package pdfsplitter;
import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.pdf.PdfCopy;
import com.lowagie.text.pdf.PdfImportedPage;
import com.lowagie.text.pdf.PdfReader;
public class SplitPDFFile {
/**
 * @param args
 */
public static void main(String[] args) {
    try {
        String inFile = args[0].toLowerCase();
        System.out.println ("Reading " + inFile);
        PdfReader reader = new PdfReader(inFile);
        int n = reader.getNumberOfPages();
        System.out.println ("Number of pages : " + n);
        int i = 0;
        while ( i < n ) {
            String outFile = inFile.substring(0, inFile.indexOf(".pdf"))
                + "-" + String.format("%03d", i + 1) + ".pdf";
            System.out.println ("Writing " + outFile);
            Document document = new Document(reader.getPageSizeWithRotation(1));
            PdfCopy writer = new PdfCopy(document, new FileOutputStream(outFile));
            document.open();
            PdfImportedPage page = writer.getImportedPage(reader, ++i);
            writer.addPage(page);
            document.close();
            writer.close();
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    /* example :
        java SplitPDFFile d:\temp\x\tx.pdf
        Reading d:\temp\x\tx.pdf
        Number of pages : 3
        Writing d:\temp\x\tx-001.pdf
        Writing d:\temp\x\tx-002.pdf
        Writing d:\temp\x\tx-003.pdf
     */
}
}
The Error here seems to be the Value of args[0] after the definition of the name of the String.
After searching for a solution and trying to fix it in different ways the error didnt got fixed once. Some advice or a link with a proper solution would be nice.
Thanks in advance,
Ulonis
