How to print the comparing result with printer setting

Tags: #<Tag:0x00007f70c59f5730> #<Tag:0x00007f70c59f55a0>

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

© Copyright 1996 - 2018, i-net software; All Rights Reserved.