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

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 GropDocs.Viewer provides a new option called RenderOriginalPageSize 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 (This example can be also found in our public GitHub repository.)

using (Viewer viewer = new Viewer("sample.pdf"))
{
    PngViewOptions viewOptions = new PngViewOptions();
    viewOptions.PdfOptions.RenderOriginalPageSize = true;
                   
    viewer.View(viewOptions);
}

More resources

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online App

Along with full-featured .NET library we provide simple but powerful free Apps. You are welcome to view Word, PDF, Excel, PowerPoint documents with free to use online GroupDocs Viewer App.