The HtmlViewOptions class has the following properties to set the image width or/and height:
/// <summary>/// Max width of an output image in pixels./// </summary>publicintImageMaxWidth{get;set;}/// <summary>/// Max height of an output image in pixels./// </summary>publicintImageMaxHeight{get;set;}/// <summary>/// The width of the output image in pixels./// </summary>publicintImageWidth{get;set;}/// <summary>/// The height of an output image in pixels./// </summary>publicintImageHeight{get;set;}
ClassSurroundingClass''' <summary>
''' Max width of an output image in pixels.
''' </summary>
PublicPropertyImageMaxWidthAsInteger''' <summary>
''' Max height of an output image in pixels.
''' </summary>
PublicPropertyImageMaxHeightAsInteger''' <summary>
''' The width of the output image in pixels.
''' </summary>
PublicPropertyImageWidthAsInteger''' <summary>
''' The height of an output image in pixels.
''' </summary>
PublicPropertyImageHeightAsIntegerEndClass
You can set the width and/or height of the output images. Use one of the following methods:
To render a single image, set ImageWidth/ImageHeight options.
To render multiple images, set ImageMaxWidth/ImageMaxHeight options. If an image exceeds these limits, it is resized proportionally.
Warning
If you set the ImageWidth/ImageHeight options, the ImageMaxWidth/ImageMaxHeight options are ignored.
To set the ImageMaxWidth/ImageMaxHeight options, follow these steps:
The following code snippet shows how to set the output image size limits:
usingGroupDocs.Viewer;usingGroupDocs.Viewer.Options;// ...using(Viewerviewer=newViewer("sample.jpeg")){// Create view options.varviewOptions=HtmlViewOptions.ForEmbeddedResources();// Specify the maximum width and height.viewOptions.ImageMaxWidth=800;viewOptions.ImageMaxHeight=600;viewer.View(viewOptions);}
ImportsGroupDocs.ViewerImportsGroupDocs.Viewer.Options' ...
ModuleProgramSubMain(argsAsString())UsingviewerAsViewer=NewViewer("sample.jpeg")' Create view options.
DimviewOptions=HtmlViewOptions.ForEmbeddedResources()' Specify the maximum width and height.
viewOptions.ImageMaxWidth=800viewOptions.ImageMaxHeight=600viewer.View(viewOptions)EndUsingEndSubEndModule
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.