Free Support Forum - aspose.com

How to convert word document to Image stream

Hi,


I would like to convert my word document to image, such that each page in word document should be converted to a separate image or image stream.

Thank you

This message was posted using Email2Forum by babar.raza.

Hello

Thanks for your request. In this case please try using the following code:

// Open document.

Document doc = new Document("C:\\Temp\\in.doc");

ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Jpeg);

options.PageCount = 1;

for (int pageIndex = 0; pageIndex < doc.PageCount; pageIndex++)

{

string outputFileName = string.Format("{0}\\{1}_{2}.Jpeg", "C:\\Temp", "Test", pageIndex + 1);

options.PageIndex = pageIndex;

doc.Save(outputFileName, options);

}

Best regards,

Thanks

This solution help me a lot.

I have another question, can we extract text and image from each word doc page one by one? i want to check if word document contains any blank (empty) page or not.

Please reply me soon. I’m trying this from last 2 days.

Hi

Thanks for your request. Word document is flow document and does not contain any information about its layout into lines and pages. Therefore, technically there is no “Page” concept in Word document.

Aspose.Words uses our own Rendering Engine to layout documents into pages. But unfortunately, there is no public API, which allows you to determine where page starts or ends. Your request has been linked to the appropriate issue. You will be notified as soon as it is supported.

But as a workaround you can try using the code provided by Adam in this thread:

http://www.aspose.com/community/forums/3/263257/add-image-to-word-document-s-each-page/showthread.aspx

Best regards,

The issues you have found earlier (filed as WORDSNET-2978) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(73)