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

Free Support Forum - aspose.com

Doc to HTML File Names

Hi There,
I have been converting Word doc’s and Pdf’s into HTML. Which has not been to much of a problem. However Aspose Pdf and Aspose Word seem to use different naming conventions when you split the pages into different files.

Any one know how to make them the same? as it’s driving me nuts.

For example

Pdf outputs


Words outputs


Also dose anyone know how to create thumbnail images of the pages. On the Pdf it was simple but can’t seem to find anything for Words.

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";




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,