Click here to Skip to main content
15,667,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to compare multiple pdf files in one folder with another but its not working for me can any one help below is the code i tried.

What I have tried:

public static void PDF_COMPARISON(String object, String data) throws Exception{
                     File[] files = new File(object).listFiles(File::isFile);
                      for (File file: files) {
                  String fileExtension = file.getName().split("\\.")[file.getName().split("\\.").length - 1];
                     if (fileExtension.toLowerCase().equals("pdf")) {
                  String File1 =  file.getAbsolutePath();
                  File[] files1 = new File(object).listFiles(File::isFile);
                      for (File file2: files1) {
                  String fileExtension1 = file2.getName().split("\\.")[file.getName().split("\\.").length - 1];
                     if (fileExtension1.toLowerCase().equals("pdf")) {
                  String File2 =  file2.getAbsolutePath();
              String ResultFile=Constants.Path_Result+DriverScript.s;
              new PdfComparator(File1,File2).compare().writeTo(ResultFile);
              }catch(Exception e){
              Log.error("Not able to Close the Browser --- " + e.getMessage());
              DriverScript.bResult = false;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900