How to compare two PDFs and export the result

First step is create a standard difference pdf presenter. We use the parent folder of the first file to store the result to.

DifferencesPDFPresenter presenter = new DifferencesPDFPresenter(<file1>.getParentFile() );

After them, use the pdf comparer add the presenter and compare then.

new PDFComparer()
            .addPresenter( presenter)
            .compare( <file1>, <file2> );

View full sourcecode