search/mag_sel search/close
Aspose::Words::Saving::DownsampleOptions Class Reference

Allows to specify downsample options.

Examples

Shows how to change the resolution of images in the PDF document.

auto doc = MakeObject<Document>(MyDir + u"Images.docx");
// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
auto options = MakeObject<PdfSaveOptions>();
// By default, Aspose.Words downsample all images in a document that we save to PDF to 220 ppi.
ASSERT_TRUE(options->get_DownsampleOptions()->get_DownsampleImages());
ASSERT_EQ(220, options->get_DownsampleOptions()->get_Resolution());
ASSERT_EQ(0, options->get_DownsampleOptions()->get_ResolutionThreshold());
doc->Save(ArtifactsDir + u"PdfSaveOptions.DownsampleOptions.Default.pdf", options);
// Set the "Resolution" property to "36" to downsample all images to 36 ppi.
options->get_DownsampleOptions()->set_Resolution(36);
// Set the "ResolutionThreshold" property to only apply the downsampling to
// images with a resolution that is above 128 ppi.
options->get_DownsampleOptions()->set_ResolutionThreshold(128);
// Only the first two images from the document will be downsampled at this stage.
doc->Save(ArtifactsDir + u"PdfSaveOptions.DownsampleOptions.LowerResolution.pdf", options);

#include <Aspose.Words.Cpp/Saving/DownsampleOptions.h>

+ Inheritance diagram for Aspose::Words::Saving::DownsampleOptions:

Public Member Functions

 DownsampleOptions ()
 
bool get_DownsampleImages () const
 Specifies whether images should be downsampled. More...
 
int32_t get_Resolution () const
 Specifies the resolution in pixels per inch which the images should be downsampled to. More...
 
int32_t get_ResolutionThreshold () const
 Specifies the threshold resolution in pixels per inch. If resolution of an image in the document is less than threshold value, the downsampling algorithm will not be applied. A value of 0 means the threshold check is not used and all images that can be reduced in size are downsampled. More...
 
virtual const TypeInfoGetType () const override
 
virtual bool Is (const TypeInfo &target) const override
 
void set_DownsampleImages (bool value)
 Setter for get_DownsampleImages. More...
 
void set_Resolution (int32_t value)
 Setter for get_Resolution. More...
 
void set_ResolutionThreshold (int32_t value)
 Setter for get_ResolutionThreshold. More...
 

Static Public Member Functions

static const TypeInfoType ()
 

Constructor & Destructor Documentation

◆ DownsampleOptions()

Aspose::Words::Saving::DownsampleOptions::DownsampleOptions ( )

Member Function Documentation

◆ get_DownsampleImages()

bool Aspose::Words::Saving::DownsampleOptions::get_DownsampleImages ( ) const

Specifies whether images should be downsampled.

Examples

Shows how to change the resolution of images in the PDF document.

auto doc = MakeObject<Document>(MyDir + u"Images.docx");
// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
auto options = MakeObject<PdfSaveOptions>();
// By default, Aspose.Words downsample all images in a document that we save to PDF to 220 ppi.
ASSERT_TRUE(options->get_DownsampleOptions()->get_DownsampleImages());
ASSERT_EQ(220, options->get_DownsampleOptions()->get_Resolution());
ASSERT_EQ(0, options->get_DownsampleOptions()->get_ResolutionThreshold());
doc->Save(ArtifactsDir + u"PdfSaveOptions.DownsampleOptions.Default.pdf", options);
// Set the "Resolution" property to "36" to downsample all images to 36 ppi.
options->get_DownsampleOptions()->set_Resolution(36);
// Set the "ResolutionThreshold" property to only apply the downsampling to
// images with a resolution that is above 128 ppi.
options->get_DownsampleOptions()->set_ResolutionThreshold(128);
// Only the first two images from the document will be downsampled at this stage.
doc->Save(ArtifactsDir + u"PdfSaveOptions.DownsampleOptions.LowerResolution.pdf", options);

◆ get_Resolution()

int32_t Aspose::Words::Saving::DownsampleOptions::get_Resolution ( ) const

Specifies the resolution in pixels per inch which the images should be downsampled to.

Examples

Shows how to change the resolution of images in the PDF document.

auto doc = MakeObject<Document>(MyDir + u"Images.docx");
// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
auto options = MakeObject<PdfSaveOptions>();
// By default, Aspose.Words downsample all images in a document that we save to PDF to 220 ppi.
ASSERT_TRUE(options->get_DownsampleOptions()->get_DownsampleImages());
ASSERT_EQ(220, options->get_DownsampleOptions()->get_Resolution());
ASSERT_EQ(0, options->get_DownsampleOptions()->get_ResolutionThreshold());
doc->Save(ArtifactsDir + u"PdfSaveOptions.DownsampleOptions.Default.pdf", options);
// Set the "Resolution" property to "36" to downsample all images to 36 ppi.
options->get_DownsampleOptions()->set_Resolution(36);
// Set the "ResolutionThreshold" property to only apply the downsampling to
// images with a resolution that is above 128 ppi.
options->get_DownsampleOptions()->set_ResolutionThreshold(128);
// Only the first two images from the document will be downsampled at this stage.
doc->Save(ArtifactsDir + u"PdfSaveOptions.DownsampleOptions.LowerResolution.pdf", options);

◆ get_ResolutionThreshold()

int32_t Aspose::Words::Saving::DownsampleOptions::get_ResolutionThreshold ( ) const

Specifies the threshold resolution in pixels per inch. If resolution of an image in the document is less than threshold value, the downsampling algorithm will not be applied. A value of 0 means the threshold check is not used and all images that can be reduced in size are downsampled.

Examples

Shows how to change the resolution of images in the PDF document.

auto doc = MakeObject<Document>(MyDir + u"Images.docx");
// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
auto options = MakeObject<PdfSaveOptions>();
// By default, Aspose.Words downsample all images in a document that we save to PDF to 220 ppi.
ASSERT_TRUE(options->get_DownsampleOptions()->get_DownsampleImages());
ASSERT_EQ(220, options->get_DownsampleOptions()->get_Resolution());
ASSERT_EQ(0, options->get_DownsampleOptions()->get_ResolutionThreshold());
doc->Save(ArtifactsDir + u"PdfSaveOptions.DownsampleOptions.Default.pdf", options);
// Set the "Resolution" property to "36" to downsample all images to 36 ppi.
options->get_DownsampleOptions()->set_Resolution(36);
// Set the "ResolutionThreshold" property to only apply the downsampling to
// images with a resolution that is above 128 ppi.
options->get_DownsampleOptions()->set_ResolutionThreshold(128);
// Only the first two images from the document will be downsampled at this stage.
doc->Save(ArtifactsDir + u"PdfSaveOptions.DownsampleOptions.LowerResolution.pdf", options);

◆ GetType()

virtual const System::TypeInfo& Aspose::Words::Saving::DownsampleOptions::GetType ( ) const
overridevirtual

Reimplemented from System::Object.

◆ Is()

virtual bool Aspose::Words::Saving::DownsampleOptions::Is ( const System::TypeInfo target) const
overridevirtual

Reimplemented from System::Object.

◆ set_DownsampleImages()

void Aspose::Words::Saving::DownsampleOptions::set_DownsampleImages ( bool  value)

◆ set_Resolution()

void Aspose::Words::Saving::DownsampleOptions::set_Resolution ( int32_t  value)

◆ set_ResolutionThreshold()

void Aspose::Words::Saving::DownsampleOptions::set_ResolutionThreshold ( int32_t  value)

◆ Type()

static const System::TypeInfo& Aspose::Words::Saving::DownsampleOptions::Type ( )
static