Aspose.Word issue

Hi,

We are using Aspose.word to create a Aspose word document.
Here,

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

We have seen some occurrences where wordDocument.PageCount fails to executed and thread gets 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);

    }
}

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,

Hi,

Please find attchached document which fails to get pageCount.

Thanks,
Payal Shah

Hi Payal,

Thanks for your inquiry. After an initial test with Aspose.Words 16.8.0, I was unable to reproduce this issue on my side. I would suggest you please upgrade to the latest version of Aspose.Words. You can download it from the following link. I hope, this helps.
https://releases.aspose.com/words/net/

Best regards,

Hi ,

I have downloaded the latest version of Aspose.Word and even with that version, code is failing to break document in to images.

Can you please suggest which piece of code you tried out.

Thanks,
Payal Shah

Hi Payal,

The following code produce image files per each page in your word document:

string filePath = MyDir + @"7+MB.doc";
Document doc = new Document(filePath);
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Jpeg);
options.PageCount = 1;
int pageCountDoc = doc.PageCount;
for (int pageCount = 0; pageCount < pageCountDoc; pageCount++)
{
    options.PageIndex = pageCount;
    doc.Save(MyDir + "out_" + pageCount + ".jpg", options);
}

Best regards,

Hi,

Currently we are using v15.4.0.0. Now as per your suggestion, we downloaded v16.8.0.0. It’s not matching with the license file which came with old version & throwing error saying

The subscription included in this license allows free upgrades until 01 Dec 2015, but this version of the product was released on 31 Aug 2016. Please renew the subscription or use a previous version of the product.”

Thanks,
Payal

Hi Payal,

We had released Aspose.Words 16.10.0 a couple of weeks ago:
https://releases.aspose.com/words/net/

To be able to use latest version you need to renew your subscription. For renewing/upgrading a subscription, please contact our sales team via Aspose.Purchase forum.

Best regards,