red6 / pdfcompare

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

withIgnore(new pageArea()) can not be resolved #63

Closed apathan123 closed 4 years ago

apathan123 commented 4 years ago

Hi I am tryign to use withIgnore function but teh code is not gettign compiled. boolean isEquals = new PdfComparator(ref, act).withIgnore(new PageArea(1, 1600, 2210, 2200,2300)).compare().writeTo(diffPath); Error in eclipse code: The method withIgnore(String) in the type PdfComparator is not applicable for the arguments (PageArea)

Can you pelase help me resolve this one

finsterwalder commented 4 years ago

That's strange. Do you use the current version of PdfCompare? 1.1.43 When you look at source code for the class IntegrationTest you will find an example just like that. https://github.com/red6/pdfcompare/blob/913c614caed7abb91fe703bfb6ed0b3d42055506/src/test/java/de/redsix/pdfcompare/IntegrationTest.java#L140

apathan123 commented 4 years ago

Hi Yes I have added dependency for current version referred in the GitHub page

On Wed, Jan 22, 2020, 11:17 PM Malte Finsterwalder notifications@github.com wrote:

That's strange. Do you use the current version of PdfCompare? When you look at source code for the class IntegrationTest you will find an example just like that.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/red6/pdfcompare/issues/63?email_source=notifications&email_token=AHUVPTDR47MGFSWHSLKJZJDQ7CBBZA5CNFSM4KKJVDDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJUPOQY#issuecomment-577304387, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHUVPTCXCOXO4JOWCLGDEUDQ7CBBZANCNFSM4KKJVDDA .

finsterwalder commented 4 years ago

Could you attach a complete Sourcefile, that shows the problem?

apathan123 commented 4 years ago

I think it does not find PageArea with co-ordinates as argument? Can not put the source code as its part of libary file I have created and is huge: Here is the fucntions which is using PdfComparator: protected boolean PDFCompare(String resultPath, String refPath) throws IOException {

    String ref = refPath;
    String act = resultPath;

    String diffPath = "/tmp/devRFB_Diff";

    @SuppressWarnings("rawtypes")
    boolean isEquals = new PdfComparator(new File(ref),new File(act)).withIgnore(new PageArea(1,1600, 2221, 2200,2300)).compare()
            .writeTo(diffPath);
    logger.info("Differece saved @ location: " + diffPath + "...............");
    System.out.println("Differece saved @ location: " + diffPath + "...............");

    if (!isEquals) {

        System.out.println("Differences found!");
    } else {
        logger.info("\nPDFs are same");
    }

    return isEquals;
}

Error screenshot at this line: image

finsterwalder commented 4 years ago

Did you check your dependencies with mvn dependency:tree? Did you jump to the source of withIgnore() and check that file? Can you create a new project with a stripped down pom file and a single class that calls PdfCompare?

finsterwalder commented 4 years ago

Your code compiles fine, when I paste it into my project. I'm pretty sure there must be something wrong with your project setup. And just some basics: Did you run a mvn clean compile? Did you restart Eclipse and Rebuilt the project in Eclipse and things like that? Since Eclipse sometimes messes up too...

apathan123 commented 4 years ago

Yes. Somethign starnge. I created new project and it compiled fine without any issues . So no point in sharing. In my existing code I dont see withIgnore(Page Area) argument function available with PDFCompare.. Yes I did mvn clean install from comand prompt still doesnt work :( what next?

finsterwalder commented 4 years ago

I still have the hunch, that somehow the wrong version of PdfCompare is used. Older versions didn't have the withIgnore(PageArea) method. When you navigate to the source of the withIgnore method, which library in which version is it in? Eclipse shows you that. Or maybe completely remove pdfcompare from your local maven repo and do a clean build again? With "rm -rf ~/.m2/repository/de/redsix" (on a Unix system) I don't know from the top of my head where the local maven repo is stored on Windows, should you use a windows system...

apathan123 commented 4 years ago

That did teh trick!! Deleted redsix from C:\Users\username.m2\repository\de and did clean istall and error is gone! Thanks So much for your swift response!!!

finsterwalder commented 4 years ago

Glad I could help. :-)