Aspose::Words::Saving::ImageSaveOptions class
Contents
[
Hide
]ImageSaveOptions class
Allows to specify additional options when rendering document pages or shapes to images. To learn more, visit the Specify Save Options documentation article.
class ImageSaveOptions : public Aspose::Words::Saving::FixedPageSaveOptions
Methods
Method | Description |
---|---|
Clone() | Creates a deep clone of this object. |
static CreateSaveOptions(Aspose::Words::SaveFormat) | Creates a save options object of a class suitable for the specified save format. |
static CreateSaveOptions(const System::String&) | Creates a save options object of a class suitable for the file extension specified in the given file name. |
Equals(System::SharedPtr<System::Object>) override | Determines whether the specified object is equal in value to the current object. |
get_AllowEmbeddingPostScriptFonts() const | Gets or sets a boolean value indicating whether to allow embedding fonts with PostScript outlines when embedding TrueType fonts in a document upon it is saved. The default value is false. |
get_ColorMode() const | Gets or sets a value determining how colors are rendered. |
get_CustomTimeZoneInfo() const | Gets or sets custom local time zone used for date/time fields. |
get_DefaultTemplate() const | Gets or sets path to default template (including filename). Default value for this property is empty string. |
get_Dml3DEffectsRenderingMode() const | Gets a value determining how 3D effects are rendered. |
virtual get_DmlEffectsRenderingMode() | Gets or sets a value determining how DrawingML effects are rendered. |
get_DmlRenderingMode() const | Gets or sets a value determining how DrawingML shapes are rendered. |
get_ExportGeneratorName() const | When true, causes the name and version of Aspose.Words to be embedded into produced files. Default value is true. |
get_HorizontalResolution() const | Gets or sets the horizontal resolution for the generated images, in dots per inch. |
get_ImageBrightness() const | Gets or sets the brightness for the generated images. |
get_ImageColorMode() const | Gets or sets the color mode for the generated images. |
get_ImageContrast() const | Gets or sets the contrast for the generated images. |
get_ImageSize() const | Gets or sets the size of a generated image in pixels. |
get_ImlRenderingMode() const | Gets or sets a value determining how ink (InkML) objects are rendered. |
get_JpegQuality() | Gets or sets a value determining the quality of the generated JPEG images. |
get_JpegQuality() const | Gets or sets a value determining the quality of the JPEG images inside Html document. |
get_MemoryOptimization() const | Gets or sets value determining if memory optimization should be performed before saving the document. Default value for this property is false. |
get_MetafileRenderingOptions() | Allows to specify how metafiles are treated in the rendered output. |
get_MetafileRenderingOptions() const | Allows to specify metafile rendering options. |
get_NumeralFormat() const | Gets or sets NumeralFormat used for rendering of numerals. European numerals are used by default. |
virtual get_OptimizeOutput() | Flag indicates whether it is required to optimize output. If this flag is set redundant nested canvases and empty canvases are removed, also neighbor glyphs with the same formatting are concatenated. Note: The accuracy of the content display may be affected if this property is set to true. Default is false. |
get_PageSavingCallback() const | Allows to control how separate pages are saved when a document is exported to fixed page format. |
get_PageSet() | Gets or sets the pages to render. Default is all the pages in the document. |
get_PageSet() const | Gets or sets the pages to render. Default is all the pages in the document. |
get_PaperColor() | Gets or sets the background (paper) color for the generated images. The default value is White. |
get_PixelFormat() const | Gets or sets the pixel format for the generated images. |
get_PrettyFormat() const | When true, pretty formats output where applicable. Default value is false. |
get_ProgressCallback() const | Called during saving a document and accepts data about saving progress. |
get_SaveFormat() override | Specifies the format in which the rendered document pages or shapes will be saved if this save options object is used. Can be a raster Tiff, Png, Bmp, Jpeg or vector Emf, Eps, WebP, Svg. |
get_Scale() const | Gets or sets the zoom factor for the generated images. |
get_TempFolder() const | Specifies the folder for temporary files used when saving to a DOC or DOCX file. By default this property is null and no temporary files are used. |
get_ThresholdForFloydSteinbergDithering() const | Gets or sets the threshold that determines the value of the binarization error in the Floyd-Steinberg method. when ImageBinarizationMethod is FloydSteinbergDithering. |
get_TiffBinarizationMethod() const | Gets or sets method used while converting images to 1 bpp format when SaveFormat is Tiff and TiffCompression is equal to Ccitt3 or Ccitt4. |
get_TiffCompression() const | Gets or sets the type of compression to apply when saving generated images to the TIFF format. |
get_UpdateCreatedTimeProperty() const | Gets a value determining whether the CreatedTime property is updated before saving. Default value is false;. |
get_UpdateFields() const | Gets or sets a value determining if fields of certain types should be updated before saving the document to a fixed page format. Default value for this property is true. |
get_UpdateLastPrintedProperty() const | Gets or sets a value determining whether the LastPrinted property is updated before saving. |
get_UpdateLastSavedTimeProperty() const | Gets or sets a value determining whether the LastSavedTime property is updated before saving. |
get_UseAntiAliasing() const | Gets or sets a value determining whether or not to use anti-aliasing for rendering. |
get_UseGdiEmfRenderer() const | Gets or sets a value determining whether to use GDI+ or Aspose.Words metafile renderer when saving to EMF. |
get_UseHighQualityRendering() const | Gets or sets a value determining whether or not to use high quality (i.e. slow) rendering algorithms. |
get_VerticalResolution() const | Gets or sets the vertical resolution for the generated images, in dots per inch. |
GetType() const override | |
ImageSaveOptions(Aspose::Words::SaveFormat) | Initializes a new instance of this class that can be used to save rendered images in the Tiff, Png, Bmp, Jpeg, Emf, Eps, WebP or Svg format. |
Is(const System::TypeInfo&) const override | |
set_AllowEmbeddingPostScriptFonts(bool) | Setter for Aspose::Words::Saving::SaveOptions::get_AllowEmbeddingPostScriptFonts. |
set_ColorMode(Aspose::Words::Saving::ColorMode) | Setter for Aspose::Words::Saving::FixedPageSaveOptions::get_ColorMode. |
set_CustomTimeZoneInfo(const System::SharedPtr<System::TimeZoneInfo>&) | Setter for Aspose::Words::Saving::SaveOptions::get_CustomTimeZoneInfo. |
set_DefaultTemplate(const System::String&) | Setter for Aspose::Words::Saving::SaveOptions::get_DefaultTemplate. |
set_Dml3DEffectsRenderingMode(Aspose::Words::Saving::Dml3DEffectsRenderingMode) | Sets a value determining how 3D effects are rendered. |
virtual set_DmlEffectsRenderingMode(Aspose::Words::Saving::DmlEffectsRenderingMode) | Setter for Aspose::Words::Saving::SaveOptions::get_DmlEffectsRenderingMode. |
set_DmlRenderingMode(Aspose::Words::Saving::DmlRenderingMode) | Setter for Aspose::Words::Saving::SaveOptions::get_DmlRenderingMode. |
set_ExportGeneratorName(bool) | Setter for Aspose::Words::Saving::SaveOptions::get_ExportGeneratorName. |
set_HorizontalResolution(float) | Setter for Aspose::Words::Saving::ImageSaveOptions::get_HorizontalResolution. |
set_ImageBrightness(float) | Setter for Aspose::Words::Saving::ImageSaveOptions::get_ImageBrightness. |
set_ImageColorMode(Aspose::Words::Saving::ImageColorMode) | Setter for Aspose::Words::Saving::ImageSaveOptions::get_ImageColorMode. |
set_ImageContrast(float) | Setter for Aspose::Words::Saving::ImageSaveOptions::get_ImageContrast. |
set_ImageSize(System::Drawing::Size) | Setter for Aspose::Words::Saving::ImageSaveOptions::get_ImageSize. |
set_ImlRenderingMode(Aspose::Words::Saving::ImlRenderingMode) | Setter for Aspose::Words::Saving::SaveOptions::get_ImlRenderingMode. |
set_JpegQuality(int32_t) | Setter for Aspose::Words::Saving::ImageSaveOptions::get_JpegQuality. |
set_MemoryOptimization(bool) | Setter for Aspose::Words::Saving::SaveOptions::get_MemoryOptimization. |
set_MetafileRenderingOptions(const System::SharedPtr<Aspose::Words::Saving::MetafileRenderingOptions>&) | Setter for Aspose::Words::Saving::FixedPageSaveOptions::get_MetafileRenderingOptions. |
set_NumeralFormat(Aspose::Words::Saving::NumeralFormat) | Setter for Aspose::Words::Saving::FixedPageSaveOptions::get_NumeralFormat. |
virtual set_OptimizeOutput(bool) | Setter for Aspose::Words::Saving::FixedPageSaveOptions::get_OptimizeOutput. |
set_PageSavingCallback(const System::SharedPtr<Aspose::Words::Saving::IPageSavingCallback>&) | Setter for Aspose::Words::Saving::FixedPageSaveOptions::get_PageSavingCallback. |
set_PageSet(const System::SharedPtr<Aspose::Words::Saving::PageSet>&) | Setter for Aspose::Words::Saving::ImageSaveOptions::get_PageSet. |
set_PaperColor(System::Drawing::Color) | Setter for Aspose::Words::Saving::ImageSaveOptions::get_PaperColor. |
set_PixelFormat(Aspose::Words::Saving::ImagePixelFormat) | Setter for Aspose::Words::Saving::ImageSaveOptions::get_PixelFormat. |
set_PrettyFormat(bool) | Setter for Aspose::Words::Saving::SaveOptions::get_PrettyFormat. |
set_ProgressCallback(const System::SharedPtr<Aspose::Words::Saving::IDocumentSavingCallback>&) | Setter for Aspose::Words::Saving::SaveOptions::get_ProgressCallback. |
set_Resolution(float) | Sets both horizontal and vertical resolution for the generated images, in dots per inch. |
set_SaveFormat(Aspose::Words::SaveFormat) override | Setter for Aspose::Words::Saving::ImageSaveOptions::get_SaveFormat. |
set_Scale(float) | Setter for Aspose::Words::Saving::ImageSaveOptions::get_Scale. |
set_TempFolder(const System::String&) | Setter for Aspose::Words::Saving::SaveOptions::get_TempFolder. |
set_ThresholdForFloydSteinbergDithering(uint8_t) | Setter for Aspose::Words::Saving::ImageSaveOptions::get_ThresholdForFloydSteinbergDithering. |
set_TiffBinarizationMethod(Aspose::Words::Saving::ImageBinarizationMethod) | Setter for Aspose::Words::Saving::ImageSaveOptions::get_TiffBinarizationMethod. |
set_TiffCompression(Aspose::Words::Saving::TiffCompression) | Setter for Aspose::Words::Saving::ImageSaveOptions::get_TiffCompression. |
set_UpdateCreatedTimeProperty(bool) | Sets a value determining whether the CreatedTime property is updated before saving. Default value is false;. |
set_UpdateFields(bool) | Setter for Aspose::Words::Saving::SaveOptions::get_UpdateFields. |
set_UpdateLastPrintedProperty(bool) | Setter for Aspose::Words::Saving::SaveOptions::get_UpdateLastPrintedProperty. |
set_UpdateLastSavedTimeProperty(bool) | Setter for Aspose::Words::Saving::SaveOptions::get_UpdateLastSavedTimeProperty. |
set_UseAntiAliasing(bool) | Setter for Aspose::Words::Saving::SaveOptions::get_UseAntiAliasing. |
set_UseGdiEmfRenderer(bool) | Setter for Aspose::Words::Saving::ImageSaveOptions::get_UseGdiEmfRenderer. |
set_UseHighQualityRendering(bool) | Setter for Aspose::Words::Saving::SaveOptions::get_UseHighQualityRendering. |
set_VerticalResolution(float) | Setter for Aspose::Words::Saving::ImageSaveOptions::get_VerticalResolution. |
static Type() |
Examples
Renders a page of a Word document into an image with transparent or colored background.
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_Font()->set_Name(u"Times New Roman");
builder->get_Font()->set_Size(24);
builder->Writeln(u"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
builder->InsertImage(ImageDir + u"Logo.jpg");
// Create an "ImageSaveOptions" object which we can pass to the document's "Save" method
// to modify the way in which that method renders the document into an image.
auto imgOptions = MakeObject<ImageSaveOptions>(SaveFormat::Png);
// Set the "PaperColor" property to a transparent color to apply a transparent
// background to the document while rendering it to an image.
imgOptions->set_PaperColor(System::Drawing::Color::get_Transparent());
doc->Save(ArtifactsDir + u"ImageSaveOptions.PaperColor.Transparent.png", imgOptions);
// Set the "PaperColor" property to an opaque color to apply that color
// as the background of the document as we render it to an image.
imgOptions->set_PaperColor(System::Drawing::Color::get_LightCoral());
doc->Save(ArtifactsDir + u"ImageSaveOptions.PaperColor.LightCoral.png", imgOptions);
Shows how to configure compression while saving a document as a JPEG.
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertImage(ImageDir + u"Logo.jpg");
// Create an "ImageSaveOptions" object which we can pass to the document's "Save" method
// to modify the way in which that method renders the document into an image.
auto imageOptions = MakeObject<ImageSaveOptions>(SaveFormat::Jpeg);
// Set the "JpegQuality" property to "10" to use stronger compression when rendering the document.
// This will reduce the file size of the document, but the image will display more prominent compression artifacts.
imageOptions->set_JpegQuality(10);
doc->Save(ArtifactsDir + u"ImageSaveOptions.JpegQuality.HighCompression.jpg", imageOptions);
ASSERT_GE(20000, MakeObject<System::IO::FileInfo>(ArtifactsDir + u"ImageSaveOptions.JpegQuality.HighCompression.jpg")->get_Length());
// Set the "JpegQuality" property to "100" to use weaker compression when rending the document.
// This will improve the quality of the image at the cost of an increased file size.
imageOptions->set_JpegQuality(100);
doc->Save(ArtifactsDir + u"ImageSaveOptions.JpegQuality.HighQuality.jpg", imageOptions);
ASSERT_LT(60000, MakeObject<System::IO::FileInfo>(ArtifactsDir + u"ImageSaveOptions.JpegQuality.HighQuality.jpg")->get_Length());
Shows how to specify a resolution while rendering a document to PNG.
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->get_Font()->set_Name(u"Times New Roman");
builder->get_Font()->set_Size(24);
builder->Writeln(u"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
builder->InsertImage(ImageDir + u"Logo.jpg");
// Create an "ImageSaveOptions" object which we can pass to the document's "Save" method
// to modify the way in which that method renders the document into an image.
auto options = MakeObject<ImageSaveOptions>(SaveFormat::Png);
// Set the "Resolution" property to "72" to render the document in 72dpi.
options->set_Resolution(72.0f);
doc->Save(ArtifactsDir + u"ImageSaveOptions.Resolution.72dpi.png", options);
ASSERT_GE(120000, MakeObject<System::IO::FileInfo>(ArtifactsDir + u"ImageSaveOptions.Resolution.72dpi.png")->get_Length());
// Set the "Resolution" property to "300" to render the document in 300dpi.
options->set_Resolution(300.0f);
doc->Save(ArtifactsDir + u"ImageSaveOptions.Resolution.300dpi.png", options);
ASSERT_LT(700000, MakeObject<System::IO::FileInfo>(ArtifactsDir + u"ImageSaveOptions.Resolution.300dpi.png")->get_Length());
See Also
- Class FixedPageSaveOptions
- Namespace Aspose::Words::Saving
- Library Aspose.Words for C++