ThumbnailGeneratingOptions Class

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

Inheritance Hierarchy

SystemObject
  Aspose.Words.RenderingThumbnailGeneratingOptions

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

Syntax

public class ThumbnailGeneratingOptions

The ThumbnailGeneratingOptions type exposes the following members.

Constructors

  NameDescription
Public methodThumbnailGeneratingOptions
Initializes a new instance of the ThumbnailGeneratingOptions class

Properties

  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.

Methods

  NameDescription
Public methodEquals (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodToString (Inherited from Object.)

Remarks

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

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