Set image resolution

On this page

If the output PDF file contains images, you can reduce its resolution.

To allow changing the image resolution, set the CompressImages and ResizeImages properties to true. The GroupDocs.Viewer compresses all images in the file. The MaxResolution property determines the maximum resolution.

The following code snippet shows how to reduce image resolution in the file:

using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
// ...

using (var viewer = new Viewer("sample.docx"))
{
    PdfViewOptions viewOptions = new PdfViewOptions();
    viewOptions.PdfOptimizationOptions = new PdfOptimizationOptions
    {
        CompressImages = true,
        ImageQuality = 50,
        ResizeImages = true,
        MaxResolution = 100
    };
     
    viewer.View(viewOptions);
}
Imports GroupDocs.Viewer
Imports GroupDocs.Viewer.Options
' ...

Module Program
    Sub Main(args As String())
        Using viewer = New Viewer("sample.docx")
            Dim viewOptions As PdfViewOptions = New PdfViewOptions()
            viewOptions.PdfOptimizationOptions = New PdfOptimizationOptions With {
                .CompressImages = True,
                .ImageQuality = 50,
                .ResizeImages = True,
                .MaxResolution = 100
                }

            viewer.View(viewOptions)
        End Using
    End Sub
End Module

The following image demonstrates the result:

Set max resolution

On this page