Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I'm reading a directory with tFileList:
05bc5d63-aef5-4e76-8d7b-789957117d31.pdf
0e9b95e7-5875-47dd-8c54-14293586ac8d.pdf
0e9b95e7-5875-47dd-8c54-14293586ac8d_Bijlage 210120065.pdf
1ab11ca4-fabf-4ace-ba6a-a32391dbb49d.pdf
1ab11ca4-fabf-4ace-ba6a-a32391dbb49d_Bijlage 210120017.pdf
...
And I want to merge the PDFs. Ie:
0e9b95e7-5875-47dd-8c54-14293586ac8d.pdf
0e9b95e7-5875-47dd-8c54-14293586ac8d_Bijlage 210120065.pdf
to
0e9b95e7-5875-47dd-8c54-14293586ac8d_merged.pdf
And
1ab11ca4-fabf-4ace-ba6a-a32391dbb49d.pdf
1ab11ca4-fabf-4ace-ba6a-a32391dbb49d_Bijlage 210120017.pdf
to
1ab11ca4-fabf-4ace-ba6a-a32391dbb49d_merged.pdf
etc.
What I tried:
I can't seem to figure it out.
Can oneone point me in the right direction? 🙂
Sincerely,
Jonathan
Fixed:
tFileList -- Iterate -- tJavaFlex
Start:
ArrayList<String> myFiles = new ArrayList<String>();
String fileNamePath = ((String)globalMap.get("tFileList_5_CURRENT_FILEPATH"));
String fileName = ((String)globalMap.get("tFileList_5_CURRENT_FILE"));
String prefix = fileName.substring(0, 36);
System.out.println("Merging " + fileName);
Main:
myFiles.add(fileNamePath);
myFiles.add(context.invoiceFolder + prefix + ".pdf");
File file1 = new File(myFiles.get(0));
File file2 = new File(myFiles.get(1));
PDFMergerUtility pdfMerger = new PDFMergerUtility();
pdfMerger.setDestinationFileName(context.invoiceFolder + "/"+ "factuur_" + prefix + ".pdf");
pdfMerger.addSource(file2);
pdfMerger.addSource(file1);
pdfMerger.mergeDocuments(null);
End:
Just a simple System.out.println();
Hi
Do you just want to merge the file name or merge the file content aslo?
Regards
Shong
Hello,
I need to merge the file content with PDFMerge but I can't seem to group them
Fixed:
tFileList -- Iterate -- tJavaFlex
Start:
ArrayList<String> myFiles = new ArrayList<String>();
String fileNamePath = ((String)globalMap.get("tFileList_5_CURRENT_FILEPATH"));
String fileName = ((String)globalMap.get("tFileList_5_CURRENT_FILE"));
String prefix = fileName.substring(0, 36);
System.out.println("Merging " + fileName);
Main:
myFiles.add(fileNamePath);
myFiles.add(context.invoiceFolder + prefix + ".pdf");
File file1 = new File(myFiles.get(0));
File file2 = new File(myFiles.get(1));
PDFMergerUtility pdfMerger = new PDFMergerUtility();
pdfMerger.setDestinationFileName(context.invoiceFolder + "/"+ "factuur_" + prefix + ".pdf");
pdfMerger.addSource(file2);
pdfMerger.addSource(file1);
pdfMerger.mergeDocuments(null);
End:
Just a simple System.out.println();