Aspose.word issue on pageCount


We are using Aspose.word to create a Aspose word document and later in to image using Aspose.Word object.

wordDocument = new Aspose.Words.Document(stream);

We have seen many occurrences where wordDocument.PageCount fails to executed and thread gets broken.

This issue is making complete functionality broken.

Can you please check this and let us know.

The code reference is below attached for understanding.

ThumbnailsToLibrary thumbnailsToLibrary = new ThumbnailsToLibrary();
string thumbName = string.Empty;

ImageSaveOptions options = new ImageSaveOptions(Aspose.Words.SaveFormat.Jpeg);

options.PageCount = 1;

Resolution resolution = new Resolution(500, 500);

JpegDevice jpegDevice = new JpegDevice(500, 500, resolution);

int pageCountDoc = wordDocument.PageCount;

for (int pageCount = 0; pageCount < pageCountDoc; pageCount++)
thumbName = item.Name.Split('.')[0] + "_" + (pageCount + 1) + ".jpg";

using (Stream stream = new MemoryStream())
options.PageIndex = pageCount;
wordDocument.Save(stream, options);

thumbnailsToLibrary.AddThumbnailInLibrary(item, stream, thumbName, spWeb, pageCount+1, sourceDocPath, workbookId);


Please let us know ASAP.

Payal Shah
Hi Payal,

Thanks for your inquiry. Could you please attach your input Word document you're getting this problem with here for testing? We will investigate the issue on our end and provide you more information.

Best regards,