The method setImageSize(Dimension) is undefined for the type ImageSaveOptions

I’m using Aspose Words for Java version 22.11 on Windows.

import com.aspose.words.*;

import java.awt.Dimension;
Document doc = new Document("mytestfile.docx");
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.PNG);
for (int page = 0; page < doc.getPageCount(); page++) {

    // Set the "PageSet" property to the number of the first page from
    // which to start rendering the document from.
    options.setPageSet(new PageSet(page));

    // Export page at 2325x5325 pixels and 600 dpi.
    options.setResolution(600f);

    Dimension dd = new Dimension(2325, 5325);

    options.setImageSize(dd);
}

In this code, options.setResolution or options.setPageSet does not throw any error.
However, VS code returns error that
“The method setImageSize(Dimension) is undefined for the type ImageSaveOptions”.

I read official document. ImageSaveOptions | Aspose.Words for Java
I don’t know why setImageSize throws error. Please advice me.

@shanaki ImageSaveOptions.setImageSize(Dimension) property has been introduced in 23.8 version of Aspose.Words. So it is not available in 22.11 version.

Thank you. I upgraded Aspose to 23.8 and error is gone.

1 Like