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.
usingGroupDocs.Viewer;usingGroupDocs.Viewer.Options;// ...using(Viewerviewer=newViewer("sample.docx")){// Create a JPG file.JpgViewOptionsviewOptions=newJpgViewOptions();// Specify the width and height.viewOptions.Width=600;viewOptions.Height=800;viewer.View(viewOptions);}
ImportsGroupDocs.ViewerImportsGroupDocs.Viewer.Options' ...
ModuleProgramSubMain(argsAsString())UsingviewerAsViewer=NewViewer("sample.docx")' Create a JPG file.
DimviewOptionsAsJpgViewOptions=NewJpgViewOptions()' Specify the width and height.
viewOptions.Width=600viewOptions.Height=800viewer.View(viewOptions)EndUsingEndSubEndModule
sample.docx is the sample file used in this example. Click here to download it.