Adjust the image size

To specify the output image size, set the Width and Height properties of the JpgViewOptions or PngViewOptions classes. Specify the value in pixels.

Note
GroupDocs.Viewer applies the aspect ratio automatically applied when you set the Width or Height value.

The following code snippet shows how to set the image width or height.

using (Viewer viewer = new Viewer("sample.docx"))
{
    // Create a JPG file.
    JpgViewOptions viewOptions = new JpgViewOptions();
    // Specify the width and height.
    viewOptions.Width = 600;
    viewOptions.Height = 800;
    
    viewer.View(viewOptions);
}