How to print the comparing result with printer setting

First you should define a printer and a container for the printer setting

PrintService printService = PrintServiceLookup
            .lookupDefaultPrintService(); //use the default printservice, for testing purposes it makes sense to use a virtual printer!
PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();

Now you can add the printer settings

attributes.add( MediaSizeName.ISO_A4 );
attributes.add( OrientationRequested.PORTRAIT );

Now you’re read to print the result

 new PDFComparer()
            .addPresenter( new DifferencesPrintPresenter( printService, attributes ) )
            .compare( <file1>, <file2> );

View full sourcecode