public static void pdfToOne(List<String> filePaths, String outPath, String outName, boolean delete) throws IOException, COSVisitorException {
String destionationFileName =outPath+File.separator+outName+".pdf";
PDFMergerUtility pdfToOne = new PDFMergerUtility();
pdfToOne.setDestinationFileName(destionationFileName);
for (int i = 0; i<filePaths.size();i++){
File file = new File(filePaths.get(i));
pdfToOne.addSource(file);
}
pdfToOne.mergeDocuments();
if(delete){
for (int i = 0; i<filePaths.size();i++){
if(!filePaths.get(i).equals(destionationFileName)){
File file = new File(filePaths.get(i));
file.delete();
}
}
}
}