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

Free Support Forum - aspose.com

Extracting images from the word document

Hello !!!

We are using the Aspose.Words version 4.2. I have a requirement in our project where i should be able to preview the document which i have generated. we are using Aspose.Words for generating the word documents.

I am trying to get the images from the document generated using the below code

Document doc = new Document(documentPath);
DocumentRenderer renderer = new DocumentRenderer(doc);
Bitmap[] arr = renderer.GetPages();
int i = 0;
foreach (Bitmap bitmap in arr)
{
    bitmap.Save("Image" + i + ".png");
}

The problem i am facing is that the saved bitmaps are empty with only header generated and rest of the content is missing.

Can you point me in right direction whether i am missing something.

Thanks & Regards

Rajesh

Hi

Thanks for your inquiry. Could you please attach your document for testing? But note that Aspose.Words.Viewer namespace is currently in beta and limited technical support is provided for it.

Best regards.

Pls find attached the document

If this is not possible is there any way i extract a image per page from the word document any

other alternative.

Thanks & Regards,

Rajesh

Hi

Thank you for additional information. It seems that all works fine on my side. Please try using the latest version of Aspose.Words. You can download it from here:

If you need extract one page from document you can use GetPage method:

Hope this helps.

Best regards.

i tried using the latest version and in that i am able to get the images only thing that is missing from the image is the line shape. Line shape is not recognized.

Can you paste teh image you have generated. so that i have a clue whether we are getting the same images.

Thanks & Regards,

Rajesh

Hi

Thanks for your inquiry. Please see the attachment. Yes line shale is missed on my side too.

Best regards.

Is this the bug with the respect to the latest version . Is there any other alternative to get the true image !

Hi

Thanks for your inquiry. As I told you earlier Aspose.Words.Viewer is currently in beta and limited technical support is provided for it. .

As a workaround you can try converting Word document to PDF using Aspose.Words and Aspose.Pdf. Please see the following link to learn how to achieve this:
http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/saving-documents.html (See “Converting to PDF” section)

Then you can convert PDF document to array of images using Aspose.Pdf.Kit. See the following link to learn more:

I hope this could help you.

Best regards.

I have tried this workaround but unfortunately we dont have license for the Aspose.pdf.kit

we have licenses for the apose.word and aspose.pdf.

if you can point to other alternave other than using aspose.pdf.kit. Since only for this functionality, getting the aspose.pdf.kit license will not be possible .

Thanks & Regards,

Hi

Unfortunately there is no other way to convert Word document to image. Why you need an exact copy of the Document? If you need to generate a simple preview I think it is enough to use Aspose.Words.Viewer.

Best regards.

Hi,

Thanks for the time and reply,

Can you point me to a URL or demo link where i can do a simple preview of the generated document in .Net, so that its visible to the user and he can print from preview.

Thanks & Regards,

Rajesh

Hi

Thanks for your inquiry. You can find Aspose.Words.Viewer demo here:
http://www.aspose.com/demos/aspose.words/

Source code of this demo you can find in the folder where Aspose.Words is installed. By default:
C:\Program Files\Aspose\Aspose.Words\Demos

Best regards.

Hi

We are happy to tell you that the new Rendering Engine has replaced the “old Viewer Beta”. The Rendering Engine can print, save as images or draw onto .NET Graphics object any document page.

Please see Aspose.Words documentation to learn more about new features.

SaveToImage method renders document pages into images:

In additional, new Rendering engine allows you to convert Word document to PDF directly (without using Aspose.Pdf).

SaveToPdf method converts the whole document or selected pages to PDF.

The latest version of Aspose.Words is available for download from here:

Best regards,