com.aspose.words
Class ThumbnailGeneratingOptions
java.lang.Object
com.aspose.words.ThumbnailGeneratingOptions
public class ThumbnailGeneratingOptions
- extends java.lang.Object
Can be used to specify additional options when generating thumbnail for a document.
User can call method Document.updateThumbnail(com.aspose.words.ThumbnailGeneratingOptions) to generate
BuiltInDocumentProperties.Thumbnail for a document.
Example:
Shows how to update a document's thumbnail.
Document doc = new Document(getMyDir() + "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(getArtifactsDir() + "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(getImageDir() + "Logo.jpg");
ThumbnailGeneratingOptions options = new ThumbnailGeneratingOptions();
options.setThumbnailSize(new Dimension(400, 400));
options.setGenerateFromFirstPage(false);
doc.updateThumbnail(options);
doc.save(getArtifactsDir() + "Document.UpdateThumbnail.FirstImage.epub");
ThumbnailGeneratingOptions
public ThumbnailGeneratingOptions()
-
Property Getters/Setters Detail |
getGenerateFromFirstPage/setGenerateFromFirstPage | |
public boolean getGenerateFromFirstPage() / public void setGenerateFromFirstPage(boolean value)
|
-
Specifies whether to generate thumbnail from first page of the document or first image.
Default is
true
, which means thumbnail will be generated from first page of the document.
If value is false
and there is no image in the document, thumbnail will be generated
from first page of the document.
Example:
Shows how to update a document's thumbnail.
Document doc = new Document(getMyDir() + "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(getArtifactsDir() + "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(getImageDir() + "Logo.jpg");
ThumbnailGeneratingOptions options = new ThumbnailGeneratingOptions();
options.setThumbnailSize(new Dimension(400, 400));
options.setGenerateFromFirstPage(false);
doc.updateThumbnail(options);
doc.save(getArtifactsDir() + "Document.UpdateThumbnail.FirstImage.epub");
getThumbnailSize/setThumbnailSize | |
public java.awt.Dimension getThumbnailSize() / public void setThumbnailSize(java.awt.Dimension value)
|
-
Size of generated thumbnail in pixels.
Default is 600x900.
Example:
Shows how to update a document's thumbnail.
Document doc = new Document(getMyDir() + "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(getArtifactsDir() + "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(getImageDir() + "Logo.jpg");
ThumbnailGeneratingOptions options = new ThumbnailGeneratingOptions();
options.setThumbnailSize(new Dimension(400, 400));
options.setGenerateFromFirstPage(false);
doc.updateThumbnail(options);
doc.save(getArtifactsDir() + "Document.UpdateThumbnail.FirstImage.epub");
See Also:
Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
Aspose.Words Support Forum - our preferred method of support.