Convert first page of Word Document to Image

Hi ,

I need to convert the first page of doc file to image . How do I do that ?
Can I get some code snippet .

Thanks in Advance.

@jaluk,

Please try using the following simple code:

Document doc = new Document("E:\\temp\\in.docx");
ImageSaveOptions saveOptions = new ImageSaveOptions(SaveFormat.Png);
saveOptions.PageIndex = 0;
saveOptions.PageCount = 1;
doc.Save("E:\\Temp\\19.7.png", saveOptions); 

Hope, this helps.

Hello, this works with older Aspose Words libraries, but I want do this in Aspose.Words 21.12. Can you provide code snippet for latest Words library? Thanks in advance.

@uros You could use the following code:

Document doc = new Document("E:\\temp\\in.docx");
ImageSaveOptions saveOptions = new ImageSaveOptions(SaveFormat.Png);
saveOptions.PageSet = new PageSet(0);
doc.Save("E:\\Temp\\out.png", saveOptions);