Hi,
Hi Roman,
Thanks for your query. Please read Document Loading Overview from following documentation link.
Please use the following code snippet to convert each document page to image file.
// Open document.
Document doc = new Document(MyDir + "in.docx");
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Png);
options.PageCount = 1;
for (int pageIndex = 0; pageIndex < doc.PageCount; pageIndex++)
{
string outputFileName = MyDir + string.Format("{0}_{1}.png", "Test", pageIndex + 1);
options.PageIndex = pageIndex;
doc.Save(outputFileName, options);
}
Please let us know if you have any more queries.
Thanks for reply,
Hi Roman,
I like to share with you that you can not get any information about document without loading it. Aspose.Words mimics the same as MS Words do. Please use the following code snippet to convert first page of document to image.
Document doc = new Document(MyDir + "in.docx");
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Png);
options.PageCount = 1;
string outputFileName = MyDir + string.Format("{0}_{1}.png", "Test", pageIndex + 1);
options.PageIndex = 0;
doc.Save(outputFileName, options);
Hi there,
Thanks for your inquiry.
When you invoke one of the members such as PageCount or UpdatePageLayout the document is rendered in memory. Most likely this operation can only be performed fully (all pages) however you might have some luck using the RenderToScale method and only passing the first page (zero index).
This might render faster than using Save although I’m not 100% sure, please let us know if it does help.