Hi Alex,
Thanks for your inquiry.
You can implement IDocumentPartSavingCallback interface if you want to receive notifications and control how Aspose.Words saves document parts when exporting a document to Html or Epub format. For example:
public class HandleDocumentPartSavingCallback : IDocumentPartSavingCallback
{
public int i = 1;
public void DocumentPartSaving(DocumentPartSavingArgs args)
{
args.DocumentPartFileName = "FileName" + i + ".html";
i++;
}
}
Document doc = new Document(MyDir + @"in.docx");
HtmlSaveOptions opts = new HtmlSaveOptions();
opts.DocumentSplitCriteria
= DocumentSplitCriteria.SectionBreak;
opts.DocumentPartSavingCallback
= new HandleDocumentPartSavingCallback();
doc.Save(MyDir + @"15.12.0.html", opts);
Secondly, one way you can use to create a thumbnail of the first page of a word document is as follows:
// Load document into Aspose.Words' DOM
Document doc = new Document(@"C:\Temp\in.docx");
// Render first page of Word document to an image stream
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Png);
options.PageIndex = 0;
options.PageCount = 1;
MemoryStream imgStream = new MemoryStream();
doc.Save(imgStream, options);
// Insert the image stream into a temporary Document instance.
Document temp = new Document();
DocumentBuilder builder = new DocumentBuilder(temp);
Shape img = builder.InsertImage(imgStream);
// Resize the image as per your needs
img.Width = 64;
img.Height = 64;
// Save the individual image to disk using ShapeRenderer class
ShapeRenderer renderer = img.GetShapeRenderer();
renderer.Save(@"C:\Temp\out.png", new ImageSaveOptions(SaveFormat.Png));
Hope, this helps.
Best regards,