red6 / pdfcompare

A simple Java library to compare two PDF files
Apache License 2.0
220 stars 66 forks source link

WARN de.redsix.pdfcompare.PdfComparator - No files found to compare #36

Closed ghost closed 6 years ago

ghost commented 6 years ago

Hi,

I'm getting the following message "WARN de.redsix.pdfcompare.PdfComparator - No files found to compare" even the PDF files were present in the path specified.

*Following is my piece of code to compare two sample PDF's:

package PDFcomparison;

import de.redsix.pdfcompare.PdfComparator;

public class pdfcomparisontest {

public static void main(String[] args) throws Exception {

    String requirement = "D:\\PDFComparisonPDFs\\doc1.pdf";
    String actual = "D:\\PDFComparisonPDFs\\doc2.pdf";
    String results = "D:\\PDFComparisonPDFs\\Results\\output";
    new PdfComparator(requirement, actual).compare().writeTo(results);
    System.out.println("Completed");

}

}

Following is the dependencies added to POM.xml

de.redsix pdfcompare 1.1.25
rweisleder commented 6 years ago

I tried to reproduce your issue with this snippet:

public static void main(String[] args) throws Exception {
    String requirement = "D:\\PDFComparisonPDFs\\doc1.pdf";
    String actual = "D:\\PDFComparisonPDFs\\doc2.pdf";

    createDummyFile(requirement);
    createDummyFile(actual);

    new PdfComparator(requirement, actual).compare();
    System.out.println("Completed");
}

private static void createDummyFile(String pathname) throws Exception {
    new File(pathname).getParentFile().mkdirs();
    try (FileOutputStream outputStream = new FileOutputStream(pathname)) {
        outputStream.write("Hello World".getBytes());
    }
}

This doesn't log "No files found to compare". (Instead it throws an Exception because my files are no pdf files obviously.) So I'm inclined to say that your specified file are really not there.

finsterwalder commented 6 years ago

From the information given, it's now possible to help you. It is most likely, that you have some typo or similar in your path/filenames. I'm very positive, the functionality works. There is also an integration test for that, which works.

finsterwalder commented 6 years ago

I close this, since I have no idea, how we could help. If your problem persists, please reopen the issue with your explanaition.

sankalprao commented 3 years ago

@rweisleder I am getting this same very issue. When I compare the code you tried to reproduce the issue from the one who reported, you are not using the method writeTo(). When we invoke this method, I am getting the same error. Can you kindly reopen this issue please and provide a fix?