ThumbnailGeneratingOptions Class

Can be used to specify additional options when generating thumbnail for a document.

ExpandedInheritance Hierarchy

SystemObject
  Aspose.Words.RenderingThumbnailGeneratingOptions

Namespace:  Aspose.Words.Rendering
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 21.5.0

ExpandedSyntax

public class ThumbnailGeneratingOptions

The ThumbnailGeneratingOptions type exposes the following members.

ExpandedConstructors

  NameDescription
Public methodThumbnailGeneratingOptions
Initializes a new instance of the ThumbnailGeneratingOptions class

ExpandedProperties

  NameDescription
Public propertyCode exampleGenerateFromFirstPage
Specifies whether to generate thumbnail from first page of the document or first image.
Public propertyCode exampleThumbnailSize
Size of generated thumbnail in pixels. Default is 600x900.

ExpandedMethods

  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)

ExpandedRemarks

User can call method UpdateThumbnail(ThumbnailGeneratingOptions) to generate Thumbnail for a document.

ExpandedExamples

Shows how to update a document's thumbnail.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.Writeln("Hello world!");
builder.InsertImage(ImageDir + "Logo.jpg");

// There are two ways of setting a thumbnail image when saving a document to .epub.
// 1 -  Use the document's first page:
doc.UpdateThumbnail();
doc.Save(ArtifactsDir + "Document.UpdateThumbnail.FirstPage.epub");

// 2 -  Use the first image found in the document:
ThumbnailGeneratingOptions options = new ThumbnailGeneratingOptions();
options.ThumbnailSize = new Size(400, 400);
options.GenerateFromFirstPage = false;

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

ExpandedSee Also