BuiltInDocumentPropertiesThumbnail Property

Gets or sets the thumbnail of the document.

Namespace:  Aspose.Words.Properties
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.7.0


public byte[] Thumbnail { get; set; }

Property Value

Type: Byte


For now this property is used only when a document is being exported to ePub, it's not read from and written to other document formats.

Image of arbitrary format can be set to this property, but the format is checked during export. InvalidOperationException is thrown if the image is invalid or its format is unsupported for specific format of document.

Only gif, jpeg and png images can be used for ePub publication.


Shows how to append a thumbnail to an Epub document.
// Create a blank document and add some text with a DocumentBuilder
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("Hello world!");

// The thumbnail property resides in a document's built in properties, but is used exclusively by Epub e-book documents
BuiltInDocumentProperties properties = doc.BuiltInDocumentProperties;

// Load an image from our file system into a byte array
byte[] thumbnailBytes = File.ReadAllBytes(ImageDir + "Logo.jpg");

// Set the value of the Thumbnail property to the array from above
properties.Thumbnail = thumbnailBytes;

// Our thumbnail should be visible at the start of the document, before the text we added
doc.Save(ArtifactsDir + "Properties.Thumbnail.epub");

// We can also extract a thumbnail property into a byte array and then into the local file system like this
DocumentProperty thumbnail = doc.BuiltInDocumentProperties["Thumbnail"];
File.WriteAllBytes(ArtifactsDir + "Properties.Thumbnail.gif", thumbnail.ToByteArray());

See Also