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 GroupDocs.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

View PDF Documents Online

Along with full-featured .NET library we provide simple but powerful free online Apps. View PDF files online with GroupDocs Viewer App.

GitHub Examples

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