Rendering pages to the same size as the size of pages in a source document

Note
This option is supported when rendering to JPG and PNG only.

When viewing PDF documents in JPG and PNG formats by default GroupDocs.Viewer calculates output image size for better viewing quality. In case you want to make output JPG and PNG images to be the same size in pixels as the size of pages in a source PDF document GroupDocs.Viewer for Java provides a new option called setRenderOriginalPageSize() of the PdfOptions class. 

The following code snippet shows how to convert pages to the same size as the size of pages in a source document.

    try (Viewer viewer = new Viewer("sample.pdf")) {
        PngViewOptions viewOptions = new PngViewOptions();
        viewOptions.getPdfOptions().setRenderOriginalPageSize(true);
                       
        viewer.view(viewOptions);
    }