For show the PDF in the own GUI, it needed a instance of ResultPage. It get it with the getPage(<pageindex>, true)
.
The first parameter is the pageindex begin with a 0.
The last parameter is true for the first pdf file and false for the seconde pdf file.
ResultModel compare = pdfComparer.compare( <file1>, <file2> );
ResultPage page = compare.getPage( 0, true );
For geting the size are the methods page.getWidth()
and
page.getHeight()
For rendering the pdf page can be used
page.renderPage( <scale>, <Graphics2D> )
alternatively can be used the follow lines
BufferedImage pageImage = page.getPageImage( 1.0 );
graphics2d.drawImage( pageImage, 0, 0, null );
For paint the change mark are following lines useful.
Only if painted as Image the page
List<DiffGroup> differences = compare.getDifferences( false );
for( DiffGroup difference : differences ) {
if( hasChangesForThisPage( difference.getModifications() ) ) {
Rectangle bounds = difference.getBounds( true );
g2d.fillRect( bounds.x, bounds.y - currentPageIndex * page.getHeight(), page.getWidth(),
bounds.height );
}
}
For detect the changes for a specific page, look at detect change per page