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

Free Support Forum - aspose.com

Preview a document on a Windows Form

Can someone please give me an example of how I can preview a document in a Windows form? I will need to be able to display all pages.

Hi James,

Thanks for your inquiry. If you need just preview of Word documents, you can convert your document to Images using Aspose.Words and show these images on your Form. Please see the following code to generate images per each page in your Word document:

Document document = new Document(@“C:\temp\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:\temp\out_{0}.jpg”, i), options);

I hope, this helps.

Best regards,

Hi Awais,
Thanks - that’s very useful - I’ll try your suggestion.