Its possible to convert each Page In Doc to signle Page?

hi all , im using C#.NET
its possible to convert each Page In Doc to signle Image Rather Than Coverting All Pages to Signle Image?

This message was posted using Aspose.Live 2 Forum

Hi
Thanks for your inquiry. Sure, you can convert a single page to image. You can use code like the following to achieve this:

// Open document.
Document doc = new Document("in.doc");
// Save a specific page as image.
ImageSaveOptions opt = new ImageSaveOptions(SaveFormat.Png);
// Specify index and number of pages.
opt.PageIndex = 2;
opt.PageCount = 1;
doc.Save("page3.png", opt);

Hope this helps.
Best regards,

hi thank u very much ,
ok what if i have Doc file and i dont know the the Total Count of Pages and i want to Save all pages??
some thing Like This:
1- getting the total Number of Pages in Doc File.
2- looping and Convert each Page to Image Based On Counter in Loop.

Can u Give Me the Code??

Hello

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

// Open document.
Document doc = new Document("in.doc");
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Png);
options.PageCount = 1;
for (int pageIndex = 0; pageIndex <doc.PageCount; pageIndex++)
{
    string outputFileName = string.Format("{0}\\{1}_{2}.png", "Temp", "Test", pageIndex + 1);
    options.PageIndex = pageIndex;
    doc.Save(outputFileName, options);
}

Best regards,