Convert doc having multiple pages into JPEG

Dear Team,

I’m able to convert my MS word doc to JPEG, but only first page is converted to image. I tried with option setPageCount(Integer.MAX_VALUE), but even only first page of my doc is converted to image.

Kindly let me know how to convert all pages in MS doc to multiple jpeg images in java.

Kindly provide sample code if you have.

Thanks in advance.

Siva.

Hi Siva,


Thanks for your inquiry.

In order to save all pages in MS Word document to separate JPEG image files, please see the following code snippet that worked for me:

Document document = new Document(@“C:\test\In.docx”);

ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Jpeg);
options.PageCount = 1;

// Save each page of the document as
Jpeg.
for (int i = 0; i <
document.PageCount; i++)
{
options.PageIndex = i;
document.Save(string.Format(@“C:\test\out_{0}.jpg”,
i), options);
}


I hope, this will help

Best Regards,

Hi Hafeez,

Thank you so much for your quick response.

Regards,
Siva.