Convert document's pages to image using Java

       ImageSaveOptions iso = new ImageSaveOptions(SaveFormat.JPEG);
        iso.setPrettyFormat(true);
        iso.setUseAntiAliasing(true);
        iso.setUseHighQualityRendering(true);
        iso.setPageCount(1);
        iso.setPageIndex(0);
        String picPath = PathUtils.getExternalAppDcimPath() + "/" + UUID.randomUUID().toString() + ".jpg";
        document.save(picPath, iso);

As above is my pseudo code,
I want to save the first page of a document as a picture,
But the code executes “document.save(picPath, iso);”
The entire document will be rendered. If the file is large, the waiting time will be up to ten seconds,
How do I save the document page by page without loading all the files,
thanks

@lingengliang

Aspose.Words loads all resources when document is imported into its DOM. Your code is correct to save the first page of document into image.

Could you please attach your input Word document here for testing? We will investigate the issue on our side and provide you more information.

@tahir.manzoor

I use “Aspose.Words for Android via Java 19.12”
test.zip (3.7 MB)

@lingengliang

You are facing the expected behavior of Aspose.Words. Please note that while rendering a document to fixed page formats (e.g. JPEG, PDF), Aspose.Words needs to build two model in the memory – one for document and the other for rendered document.

We have logged this performance issue in our issue tracking system as WORDSNET-20120. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-20120) have been fixed in this Aspose.Words for .NET 20.6 update and this Aspose.Words for Java 20.6 update.