DocumentUpdateThumbnail(ThumbnailGeneratingOptions) Method

Updates Thumbnail of the document according to the specified options.

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

Syntax

public void UpdateThumbnail(
	ThumbnailGeneratingOptions options
)

Parameters

options
Type: Aspose.Words.RenderingThumbnailGeneratingOptions
The generating options to use.

Remarks

The ThumbnailGeneratingOptions allows you to specify the source of thumbnail, size and other options. If attempt to generate thumbnail fails, doesn't change one.

Examples

Shows how to update a document's thumbnail.
Document doc = new Document(MyDir + "Rendering.docx");

// If we aren't setting the thumbnail via built in document properties,
// we can set the first page of the document to be the thumbnail in an output .epub like this
doc.UpdateThumbnail();
doc.Save(ArtifactsDir + "Document.UpdateThumbnail.FirstPage.epub");

// Another way is to use the first image shape found in the document as the thumbnail
// Insert an image with a builder that we want to use as a thumbnail
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertImage(ImageDir + "Logo.jpg");

ThumbnailGeneratingOptions options = new ThumbnailGeneratingOptions();
options.ThumbnailSize = new Size(400, 400);
options.GenerateFromFirstPage = false;

doc.UpdateThumbnail(options);
doc.Save(ArtifactsDir + "Document.UpdateThumbnail.FirstImage.epub");

See Also