# Set image size limits
Set image size limits when rendering image to PDF
The [PdfViewOptions](https://reference.groupdocs.com/net/viewer/groupdocs.viewer.options/pdfviewoptions) class has the following properties to set the image width or/and height:
{{< tabs "pdf-image-size-properties">}}
{{< tab "C#" >}}
```csharp
///
/// Max width of an output image in pixels.
///
public int ImageMaxWidth { get; set; }
///
/// Max height of an output image in pixels.
///
public int ImageMaxHeight { get; set; }
///
/// The width of the output image in pixels.
///
public int ImageWidth { get; set; }
///
/// The height of an output image in pixels.
///
public int ImageHeight { get; set; }
```
{{< /tab >}}
{{< tab "VB.NET">}}
```vb
Class SurroundingClass
'''
''' Max width of an output image in pixels.
'''
Public Property ImageMaxWidth As Integer
'''
''' Max height of an output image in pixels.
'''
Public Property ImageMaxHeight As Integer
'''
''' The width of the output image in pixels.
'''
Public Property ImageWidth As Integer
'''
''' The height of an output image in pixels.
'''
Public Property ImageHeight As Integer
End Class
```
{{< /tab >}}
{{< /tabs >}}
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.
{{< alert style="warning" >}}
If you set the ImageWidth/ImageHeight options, the ImageMaxWidth/ImageMaxHeight options are ignored.
{{< /alert >}}
To set the ImageMaxWidth/ImageMaxHeight options, follow these steps:
1. Instantiate the [Viewer](https://reference.groupdocs.com/net/viewer/groupdocs.viewer/viewer) object.
2. Instantiate the [PdfViewOptions](https://reference.groupdocs.com/net/viewer/groupdocs.viewer.options/pdfviewoptions) object.
3. Set the ImageMaxWidth and/or ImageMaxHeight values;
4. Call the [View](https://reference.groupdocs.com/net/viewer/groupdocs.viewer/viewer/methods/view) method.
The following code snippet shows how to set the output image size limits:
{{< tabs "set-image-size-limits">}}
{{< tab "C#" >}}
```csharp
using GroupDocs.Viewer.Options;
using GroupDocs.Viewer;
// ...
using (Viewer viewer = new Viewer("sample.jpg"))
{
// Create a PDF file.
PdfViewOptions viewOptions = new PdfViewOptions();
// Specify the maximum width and height.
viewOptions.ImageMaxWidth = 800;
viewOptions.ImageMaxHeight = 600;
viewer.View(viewOptions);
}
```
{{< /tab >}}
{{< tab "VB.NET">}}
```vb
Imports GroupDocs.Viewer.Options
Imports GroupDocs.Viewer
' ...
Module Program
Sub Main(args As String())
Using viewer As Viewer = New Viewer("sample.jpg")
' Create a PDF file.
Dim viewOptions As PdfViewOptions = New PdfViewOptions()
' Specify the maximum width and height.
viewOptions.ImageMaxWidth = 800
viewOptions.ImageMaxHeight = 600
viewer.View(viewOptions)
End Using
End Sub
End Module
```
{{< /tab >}}
{{< tab "sample.jpg" >}}
{{< tab-text >}}
`sample.jpg` is the sample file used in this example. Click [here](https://docs.groupdocs.com/viewer/net/_sample_files/developer-guide/rendering-documents/rendering-to-pdf/set-image-size-limits-when-rendering-to-pdf/sample.jpg) to download it.
{{< /tab-text >}}
{{< /tab >}}
{{< tab "output.pdf" >}}
```text
Binary file (PDF, 590 KB)
```
[Download full output](https://docs.groupdocs.com/viewer/net/_output_files/developer-guide/rendering-documents/rendering-to-pdf/set-image-size-limits-when-rendering-to-pdf/SetImageSizeLimits/output.pdf)
{{< /tab >}}
{{< /tabs >}}