We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Word document as PNG timeout


We are having a problem converting Word document to PNG format. If document contains hidden fields/hyperlinks (our assumption), then Save method never completes.

Code used:
var doc = new Document(“Example.docx”);

        for (int i = 0; i <= doc.PageCount - 1; i++)
            using (var imageStream = new MemoryStream())
                doc.Save(imageStream, new Aspose.Words.Saving.ImageSaveOptions(Aspose.Words.SaveFormat.Png) { PageIndex = i });

Archive with erroneous Word document:
Example.zip (15.8 KB)

Could you, please, take a look at this?



Thanks for your inquiry. We suggest you please implement the IPageSavingCallback interface to achieve your requirement. Please use the latest version of Aspose.Words for .NET 19.1.

Document doc = new Document(MyDir + "Example.docx");

ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Png);
options.PageSavingCallback = new HandlePageSavingCallback();

doc.Save(MyDir + "19.1.png", options);

private class HandlePageSavingCallback : IPageSavingCallback
    public void PageSaving(PageSavingArgs args)
        args.PageFileName = string.Format(MyDir + @"Page_{0}.png", args.PageIndex);
1 Like

Thanks, it worked.