# How show the PDF's with change marks

**URL:** <https://faq.inetsoftware.de/t/how-show-the-pdfs-with-change-marks/61>\
**Category:** API\
**Created:** [June 8, 2016, 6:14am UTC](https://faq.inetsoftware.de/t/how-show-the-pdfs-with-change-marks/61 "2016-06-08T06:14:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RichardRoedel](https://faq.inetsoftware.de/user_avatar/faq.inetsoftware.de/richardroedel/32/27_2.png) [@RichardRoedel](https://faq.inetsoftware.de/u/RichardRoedel)\
**Post date:** [June 8, 2016, 6:14am UTC](https://faq.inetsoftware.de/t/how-show-the-pdfs-with-change-marks/61/1 "2016-06-08T06:14:04Z")

</div>

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](https://static.217.19.98.91.clients.your-server.de/t/how-to-get-the-differences-per-page-for-two-pdfs/51)

[View full sourcecode](https://github.com/i-net-software/pdfc-samples/blob/master/src/main/java/render/Render.java)
