Aspose::Words::Rendering::ThumbnailGeneratingOptions class

ThumbnailGeneratingOptions class

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

class ThumbnailGeneratingOptions : public System::Object

Methods

MethodDescription
get_GenerateFromFirstPage() constSpecifies whether to generate thumbnail from first page of the document or first image.
get_ThumbnailSize() constSize of generated thumbnail in pixels. Default is 600x900.
GetType() const override
Is(const System::TypeInfo&) const override
set_GenerateFromFirstPage(bool)Setter for Aspose::Words::Rendering::ThumbnailGeneratingOptions::get_GenerateFromFirstPage.
set_ThumbnailSize(System::Drawing::Size)Setter for Aspose::Words::Rendering::ThumbnailGeneratingOptions::get_ThumbnailSize.
ThumbnailGeneratingOptions()
static Type()

Examples

Shows how to update a document’s thumbnail.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);

builder->Writeln(u"Hello world!");
builder->InsertImage(ImageDir + u"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 + u"Document.UpdateThumbnail.FirstPage.epub");

// 2 -  Use the first image found in the document:
auto options = MakeObject<ThumbnailGeneratingOptions>();
options->set_ThumbnailSize(System::Drawing::Size(400, 400));
options->set_GenerateFromFirstPage(false);

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

See Also