Aspose::Words::Saving::FixedPageSaveOptions Class Reference

Detailed Description

Contains common options that can be specified when saving a document into fixed page formats (PDF, XPS, images etc).

Examples

Converts every page of a DOC file into a separate scalable EMF file.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
auto options = MakeObject<ImageSaveOptions>(Aspose::Words::SaveFormat::Emf);
options->set_PageCount(1);
for (int i = 0; i < doc->get_PageCount(); i++)
{
options->set_PageIndex(i);
doc->Save(ArtifactsDir + u"Rendering.SaveToEmf." + i + u".emf", options);
}

#include <Aspose.Words.Cpp/Model/Saving/FixedPageSaveOptions.h>

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

Public Member Functions

bool Equals (SharedPtr< Object > obj) override
 Determines whether the specified object is equal in value to the current object. More...
 
ColorMode get_ColorMode () const
 Gets or sets a value determining how colors are rendered. More...
 
int32_t get_JpegQuality () const
 Gets or sets a value determining the quality of the JPEG images inside Html document. More...
 
SharedPtr< MetafileRenderingOptionsget_MetafileRenderingOptions () const
 Allows to specify metafile rendering options. More...
 
NumeralFormat get_NumeralFormat () const
 Gets or sets NumeralFormat used for rendering of numerals. European numerals are used by default. More...
 
virtual bool 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. More...
 
int32_t get_PageCount () const
 Gets or sets the number of pages to save. Default is MaxValue which means all pages of the document will be rendered. More...
 
int32_t get_PageIndex () const
 Gets or sets the 0-based index of the first page to save. Default is 0. More...
 
SharedPtr< IPageSavingCallbackget_PageSavingCallback () const
 Allows to control how separate pages are saved when a document is exported to fixed page format. More...
 
SharedPtr< PageSetget_PageSet () const
 Gets the pages to render. Default is all the pages in the document. More...
 
virtual const TypeInfoGetType () const override
 
virtual bool Is (const TypeInfo &target) const override
 
void set_ColorMode (ColorMode value)
 Setter for get_ColorMode. More...
 
void set_JpegQuality (int32_t value)
 Setter for get_JpegQuality. More...
 
void set_MetafileRenderingOptions (SharedPtr< MetafileRenderingOptions > value)
 Allows to specify metafile rendering options. More...
 
void set_NumeralFormat (NumeralFormat value)
 Setter for get_NumeralFormat. More...
 
virtual void set_OptimizeOutput (bool value)
 Setter for get_OptimizeOutput. More...
 
void set_PageCount (int32_t value)
 Setter for get_PageCount. More...
 
void set_PageIndex (int32_t value)
 Setter for get_PageIndex. More...
 
void set_PageSavingCallback (SharedPtr< IPageSavingCallback > value)
 Allows to control how separate pages are saved when a document is exported to fixed page format. More...
 
void set_PageSet (SharedPtr< PageSet > value)
 Sets the pages to render. Default is all the pages in the document. More...
 
- Public Member Functions inherited from SaveOptions
String get_DefaultTemplate () const
 Gets or sets path to default template (including filename). Default value for this property is empty string (Empty). More...
 
Dml3DEffectsRenderingMode get_Dml3DEffectsRenderingMode () const
 Gets a value determining how 3D effects are rendered. More...
 
virtual DmlEffectsRenderingMode get_DmlEffectsRenderingMode ()
 Gets or sets a value determining how DrawingML effects are rendered. More...
 
DmlRenderingMode get_DmlRenderingMode () const
 Gets or sets a value determining how DrawingML shapes are rendered. More...
 
bool 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. More...
 
bool get_PrettyFormat () const
 When true, pretty formats output where applicable. Default value is false. More...
 
virtual SaveFormat get_SaveFormat ()=0
 Specifies the format in which the document will be saved if this save options object is used. More...
 
String 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. More...
 
bool 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. More...
 
bool get_UpdateLastPrintedProperty () const
 Gets or sets a value determining whether the LastPrinted property is updated before saving. More...
 
bool get_UpdateLastSavedTimeProperty () const
 Gets or sets a value determining whether the LastSavedTime property is updated before saving. More...
 
bool get_UpdateSdtContent () const
 Gets or sets value determining whether content of StructuredDocumentTag is updated before saving. More...
 
bool get_UseAntiAliasing () const
 Gets or sets a value determining whether or not to use anti-aliasing for rendering. More...
 
bool get_UseHighQualityRendering () const
 Gets or sets a value determining whether or not to use high quality (i.e. slow) rendering algorithms. More...
 
void set_DefaultTemplate (String value)
 Setter for get_DefaultTemplate. More...
 
void set_Dml3DEffectsRenderingMode (Dml3DEffectsRenderingMode value)
 Sets a value determining how 3D effects are rendered. More...
 
virtual void set_DmlEffectsRenderingMode (DmlEffectsRenderingMode value)
 Setter for get_DmlEffectsRenderingMode. More...
 
void set_DmlRenderingMode (DmlRenderingMode value)
 Setter for get_DmlRenderingMode. More...
 
void set_MemoryOptimization (bool value)
 Setter for get_MemoryOptimization. More...
 
void set_PrettyFormat (bool value)
 Setter for get_PrettyFormat. More...
 
virtual void set_SaveFormat (SaveFormat value)=0
 Setter for get_SaveFormat. More...
 
void set_TempFolder (String value)
 Setter for get_TempFolder. More...
 
void set_UpdateFields (bool value)
 Setter for get_UpdateFields. More...
 
void set_UpdateLastPrintedProperty (bool value)
 Setter for get_UpdateLastPrintedProperty. More...
 
void set_UpdateLastSavedTimeProperty (bool value)
 Setter for get_UpdateLastSavedTimeProperty. More...
 
void set_UpdateSdtContent (bool value)
 Setter for get_UpdateSdtContent. More...
 
void set_UseAntiAliasing (bool value)
 Setter for get_UseAntiAliasing. More...
 
void set_UseHighQualityRendering (bool value)
 Setter for get_UseHighQualityRendering. More...
 
- Public Member Functions inherited from Object
ASPOSECPP_SHARED_API Object ()
 
ASPOSECPP_SHARED_API Object (Object const &x)
 
virtual ASPOSECPP_SHARED_API ~Object ()
 
virtual ASPOSECPP_SHARED_API bool Equals (ptr obj)
 
Detail::SmartPtrCounter * GetCounter ()
 
virtual ASPOSECPP_SHARED_API int GetHashCode () const
 
ASPOSECPP_SHARED_API void Lock ()
 
virtual ASPOSECPP_SHARED_API ptr MemberwiseClone () const
 
Objectoperator= (Object const &x)
 
bool ReferenceEquals (String const &str, std::nullptr_t)
 
bool ReferenceEquals (String const &str1, String const &str2)
 
int RemovedSharedRefs (int count)
 
virtual ASPOSECPP_SHARED_API void SetTemplateWeakPtr (unsigned int argument)
 
int SharedCount () const
 
ObjectSharedRefAdded ()
 
int SharedRefRemovedSafe ()
 
virtual ASPOSECPP_SHARED_API String ToString () const
 
ASPOSECPP_SHARED_API void Unlock ()
 
Detail::SmartPtrCounter * WeakRefAdded ()
 
void WeakRefRemoved ()
 

Static Public Member Functions

static const TypeInfoType ()
 
- Static Public Member Functions inherited from SaveOptions
static SharedPtr< SaveOptionsCreateSaveOptions (SaveFormat saveFormat)
 Creates a save options object of a class suitable for the specified save format. More...
 
static SharedPtr< SaveOptionsCreateSaveOptions (String fileName)
 Creates a save options object of a class suitable for the file extension specified in the given file name. More...
 
static const TypeInfoType ()
 
- Static Public Member Functions inherited from Object
bool Equals (double const &objA, double const &objB)
 
bool Equals (float const &objA, float const &objB)
 
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 
static const TypeInfoType ()
 

Additional Inherited Members

- Public Types inherited from Object
typedef SmartPtr< Objectptr
 
typedef System::Details::SharedMembersType shared_members_type
 

Member Function Documentation

◆ Equals()

bool Aspose::Words::Saving::FixedPageSaveOptions::Equals ( System::SharedPtr< System::Object obj)
override

Determines whether the specified object is equal in value to the current object.

◆ get_ColorMode()

Aspose::Words::Saving::ColorMode Aspose::Words::Saving::FixedPageSaveOptions::get_ColorMode ( ) const

Gets or sets a value determining how colors are rendered.

Examples

Shows how change image color with save options property.

auto doc = MakeObject<Document>(MyDir + u"Images.docx");
// Configure PdfSaveOptions to save every image in the input document in greyscale during conversion
auto pdfSaveOptions = MakeObject<PdfSaveOptions>();
pdfSaveOptions->set_ColorMode(Aspose::Words::Saving::ColorMode::Grayscale);
doc->Save(ArtifactsDir + u"PdfSaveOptions.ColorRendering.pdf", pdfSaveOptions);

◆ get_JpegQuality()

int32_t Aspose::Words::Saving::FixedPageSaveOptions::get_JpegQuality ( ) const

Gets or sets a value determining the quality of the JPEG images inside Html document.

Has effect only when a document contains JPEG images.

Use this property to get or set the quality of the images inside a document when saving in fixed page format. The value may vary from 0 to 100 where 0 means worst quality but maximum compression and 100 means best quality but minimum compression.

The default value is 95.

Examples

Converts a page of a Word document into JPEG images of different qualities.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
auto saveOptions = MakeObject<ImageSaveOptions>(Aspose::Words::SaveFormat::Jpeg);
// Try worst quality
saveOptions->set_JpegQuality(0);
doc->Save(ArtifactsDir + u"Rendering.SaveToImageJpegQuality.0.jpeg", saveOptions);
// Try best quality
saveOptions->set_JpegQuality(100);
doc->Save(ArtifactsDir + u"Rendering.SaveToImageJpegQuality.100.jpeg", saveOptions);

◆ get_MetafileRenderingOptions()

System::SharedPtr<Aspose::Words::Saving::MetafileRenderingOptions> Aspose::Words::Saving::FixedPageSaveOptions::get_MetafileRenderingOptions ( ) const

Allows to specify metafile rendering options.

◆ get_NumeralFormat()

Aspose::Words::Saving::NumeralFormat Aspose::Words::Saving::FixedPageSaveOptions::get_NumeralFormat ( ) const

Gets or sets NumeralFormat used for rendering of numerals. European numerals are used by default.

Examples

Demonstrates how to set the numeral format used when saving to PDF.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->Writeln(u"1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 50, 100");
auto options = MakeObject<PdfSaveOptions>();
doc->Save(ArtifactsDir + u"Rendering.SetNumeralFormat.pdf", options);

◆ get_OptimizeOutput()

virtual bool Aspose::Words::Saving::FixedPageSaveOptions::get_OptimizeOutput ( )
virtual

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.

Examples

Shows how to optimize document objects while saving to html.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
auto saveOptions = MakeObject<HtmlFixedSaveOptions>();
saveOptions->set_OptimizeOutput(false);
doc->Save(ArtifactsDir + u"HtmlFixedSaveOptions.OptimizeGraphicsOutput.Unoptimized.html", saveOptions);
saveOptions->set_OptimizeOutput(true);
doc->Save(ArtifactsDir + u"HtmlFixedSaveOptions.OptimizeGraphicsOutput.Optimized.html", saveOptions);
ASSERT_TRUE(MakeObject<System::IO::FileInfo>(ArtifactsDir + u"HtmlFixedSaveOptions.OptimizeGraphicsOutput.Unoptimized.html")->get_Length() > MakeObject<System::IO::FileInfo>(ArtifactsDir + u"HtmlFixedSaveOptions.OptimizeGraphicsOutput.Optimized.html")->get_Length());

Shows how to optimize document objects while saving to xps.

auto doc = MakeObject<Document>(MyDir + u"Unoptimized document.docx");
// When saving to .xps, we can use SaveOptions to optimize the output in some cases
auto saveOptions = MakeObject<XpsSaveOptions>();
saveOptions->set_OptimizeOutput(optimizeOutput);
doc->Save(ArtifactsDir + u"XpsSaveOptions.OptimizeOutput.xps", saveOptions);
// The input document had adjacent runs with the same formatting, which, if output optimization was enabled,
// have been combined to save space
auto outFileInfo = MakeObject<System::IO::FileInfo>(ArtifactsDir + u"XpsSaveOptions.OptimizeOutput.xps");
if (optimizeOutput)
{
ASSERT_TRUE(outFileInfo->get_Length() < 45000);
}
else
{
ASSERT_TRUE(outFileInfo->get_Length() > 60000);
}

Reimplemented in Aspose::Words::Saving::HtmlFixedSaveOptions.

◆ get_PageCount()

int32_t Aspose::Words::Saving::FixedPageSaveOptions::get_PageCount ( ) const

Gets or sets the number of pages to save. Default is MaxValue which means all pages of the document will be rendered.

Examples

Converts just one page (third page in this example) of the document to PDF.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
{
SharedPtr<System::IO::Stream> stream = System::IO::File::Create(ArtifactsDir + u"Rendering.SaveToPdfStreamOnePage.pdf");
auto options = MakeObject<PdfSaveOptions>();
options->set_PageIndex(2);
options->set_PageCount(1);
doc->Save(stream, options);
}

◆ get_PageIndex()

int32_t Aspose::Words::Saving::FixedPageSaveOptions::get_PageIndex ( ) const

Gets or sets the 0-based index of the first page to save. Default is 0.

Examples

Converts just one page (third page in this example) of the document to PDF.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
{
SharedPtr<System::IO::Stream> stream = System::IO::File::Create(ArtifactsDir + u"Rendering.SaveToPdfStreamOnePage.pdf");
auto options = MakeObject<PdfSaveOptions>();
options->set_PageIndex(2);
options->set_PageCount(1);
doc->Save(stream, options);
}

◆ get_PageSavingCallback()

System::SharedPtr<Aspose::Words::Saving::IPageSavingCallback> Aspose::Words::Saving::FixedPageSaveOptions::get_PageSavingCallback ( ) const

Allows to control how separate pages are saved when a document is exported to fixed page format.

◆ get_PageSet()

System::SharedPtr<Aspose::Words::Saving::PageSet> Aspose::Words::Saving::FixedPageSaveOptions::get_PageSet ( ) const

Gets the pages to render. Default is all the pages in the document.

◆ GetType()

◆ Is()

◆ set_ColorMode()

void Aspose::Words::Saving::FixedPageSaveOptions::set_ColorMode ( Aspose::Words::Saving::ColorMode  value)

◆ set_JpegQuality()

void Aspose::Words::Saving::FixedPageSaveOptions::set_JpegQuality ( int32_t  value)

◆ set_MetafileRenderingOptions()

void Aspose::Words::Saving::FixedPageSaveOptions::set_MetafileRenderingOptions ( System::SharedPtr< Aspose::Words::Saving::MetafileRenderingOptions value)

Allows to specify metafile rendering options.

◆ set_NumeralFormat()

void Aspose::Words::Saving::FixedPageSaveOptions::set_NumeralFormat ( Aspose::Words::Saving::NumeralFormat  value)

◆ set_OptimizeOutput()

virtual void Aspose::Words::Saving::FixedPageSaveOptions::set_OptimizeOutput ( bool  value)
virtual

◆ set_PageCount()

void Aspose::Words::Saving::FixedPageSaveOptions::set_PageCount ( int32_t  value)

◆ set_PageIndex()

void Aspose::Words::Saving::FixedPageSaveOptions::set_PageIndex ( int32_t  value)

◆ set_PageSavingCallback()

void Aspose::Words::Saving::FixedPageSaveOptions::set_PageSavingCallback ( System::SharedPtr< Aspose::Words::Saving::IPageSavingCallback value)

Allows to control how separate pages are saved when a document is exported to fixed page format.

◆ set_PageSet()

void Aspose::Words::Saving::FixedPageSaveOptions::set_PageSet ( System::SharedPtr< Aspose::Words::Saving::PageSet value)

Sets the pages to render. Default is all the pages in the document.

◆ Type()

static const System::TypeInfo& Aspose::Words::Saving::FixedPageSaveOptions::Type ( )
static
@ EasternArabicIndic
Numerals used in Persian and Urdu: ۰۱۲۳۴۵۶۷۸۹. Unicode range U+06F0 - u+06F9.
@ Emf
Renders a page of the document and saves it as a vector EMF (Enhanced Meta File) file.
static ASPOSECPP_SHARED_API FileStreamPtr Create(const String &path, int32_t bufferSize=DefaultBufferSize, FileOptions options=FileOptions::None)
@ Jpeg
Renders a page of the document and saves it as a JPEG file.
@ Grayscale
Rendering with colors in a range of gray shades from white to black.