Adjust image size

Image Viewer allows you to set custom output image size in pixels through setWidth() and setHeight() properties in JpgViewOptions  and PngViewOptions classes.

Keep in mind that aspect ratio is automatically applied when you set setWidth() or setHeight() only.

This example demonstrates how to set output image size

    try (Viewer viewer = new Viewer("sample.docx")) {
        JpgViewOptions viewOptions = new JpgViewOptions();
        viewOptions.setWidth(600);
        viewOptions.setHeight(800);
    
        viewer.view(viewOptions);
    }