Aspose::Words::Saving::PdfSaveOptions Class Reference

Detailed Description

Can be used to specify additional options when saving a document into the Pdf format.

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);

Converts a whole document to PDF with three levels in the document outline.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
auto options = MakeObject<PdfSaveOptions>();
options->get_OutlineOptions()->set_HeadingsOutlineLevels(3);
options->get_OutlineOptions()->set_ExpandedOutlineLevels(1);
doc->Save(ArtifactsDir + u"Rendering.SaveToPdfWithOutline.pdf", options);

Saves a document to PDF without compression.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
auto options = MakeObject<PdfSaveOptions>();
doc->Save(ArtifactsDir + u"Rendering.SaveToPdfNoCompression.pdf", options);

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

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

Public Member Functions

 PdfSaveOptions ()
 Initializes a new instance of this class that can be used to save a document in the Pdf format. More...
 
SharedPtr< PdfSaveOptionsClone ()
 Creates a deep clone of this object. More...
 
bool get_AdditionalTextPositioning () const
 A flag specifying whether to write additional text positioning operators or not. More...
 
PdfCompliance get_Compliance ()
 Specifies the PDF standards compliance level for output documents. More...
 
bool get_CreateNoteHyperlinks () const
 Specifies whether to convert footnote/endnote references in main text story into active hyperlinks. When clicked the hyperlink will lead to the corresponding footnote/endnote. Default is false. More...
 
PdfCustomPropertiesExport get_CustomPropertiesExport () const
 Gets or sets a value determining the way CustomDocumentProperties are exported to PDF file. Default value is None. More...
 
SharedPtr< PdfDigitalSignatureDetailsget_DigitalSignatureDetails () const
 Gets or sets the details for signing the output PDF document. More...
 
bool get_DisplayDocTitle () const
 A flag specifying whether the window’s title bar should display the document title taken from the Title entry of the document information dictionary. More...
 
DmlEffectsRenderingMode get_DmlEffectsRenderingMode () override
 Gets or sets a value determining how DrawingML effects are rendered. More...
 
SharedPtr< DownsampleOptionsget_DownsampleOptions () const
 Allows to specify downsample options. More...
 
bool get_EmbedFullFonts () const
 Controls how fonts are embedded into the resulting PDF documents. More...
 
SharedPtr< PdfEncryptionDetailsget_EncryptionDetails () const
 Gets or sets the details for encrypting the output PDF document. More...
 
bool get_EscapeUri () const
 A flag specifying whether URI should be escaped before writing. More...
 
bool get_ExportDocumentStructure () const
 Gets or sets a value determining whether or not to export document structure. More...
 
PdfFontEmbeddingMode get_FontEmbeddingMode () const
 Specifies the font embedding mode. More...
 
HeaderFooterBookmarksExportMode get_HeaderFooterBookmarksExportMode () const
 Determines how bookmarks in headers/footers are exported. More...
 
PdfImageColorSpaceExportMode get_ImageColorSpaceExportMode () const
 Specifies how the color space will be selected for the images in PDF document. More...
 
PdfImageCompression get_ImageCompression () const
 Specifies compression type to be used for all images in the document. More...
 
bool get_InterpolateImages () const
 A flag indicating whether image interpolation shall be performed by a conforming reader. When false is specified, the flag is not written to the output document and the default behaviour of reader is used instead. More...
 
int32_t get_JpegQuality ()
 Gets or sets a value determining the quality of the JPEG images inside PDF document. More...
 
bool get_OpenHyperlinksInNewWindow () const
 Gets or sets a value determining whether hyperlinks in the output Pdf document are forced to be opened in a new window (or tab) of a browser. More...
 
SharedPtr< OutlineOptionsget_OutlineOptions () const
 Allows to specify outline options. More...
 
PdfPageMode get_PageMode () const
 Specifies how the PDF document should be displayed when opened in the PDF reader. More...
 
bool get_PreblendImages () const
 Gets or sets a value determining whether or not to preblend transparent images with black background color. More...
 
bool get_PreserveFormFields () const
 Specifies whether to preserve Microsoft Word form fields as form fields in PDF or convert them to text. Default is false. More...
 
SaveFormat get_SaveFormat () override
 Specifies the format in which the document will be saved if this save options object is used. Can only be Pdf. More...
 
PdfTextCompression get_TextCompression () const
 Specifies compression type to be used for all textual content in the document. More...
 
bool get_UseBookFoldPrintingSettings () const
 Gets or sets a boolean value indicating whether the document should be saved using a booklet printing layout, if it is specified via MultiplePages. More...
 
bool get_UseCoreFonts () const
 Gets or sets a value determining whether or not to substitute TrueType fonts Arial, Times New Roman, Courier New and Symbol with core PDF Type 1 fonts. More...
 
PdfZoomBehavior get_ZoomBehavior () const
 Gets or sets a value determining what type of zoom should be applied when a document is opened with a PDF viewer. More...
 
int32_t get_ZoomFactor () const
 Gets or sets a value determining zoom factor (in percentages) for a document. More...
 
virtual const TypeInfoGetType () const override
 
virtual bool Is (const TypeInfo &target) const override
 
void set_AdditionalTextPositioning (bool value)
 Setter for get_AdditionalTextPositioning. More...
 
void set_Compliance (PdfCompliance value)
 Setter for get_Compliance. More...
 
void set_CreateNoteHyperlinks (bool value)
 Setter for get_CreateNoteHyperlinks. More...
 
void set_CustomPropertiesExport (PdfCustomPropertiesExport value)
 Setter for get_CustomPropertiesExport. More...
 
void set_DigitalSignatureDetails (SharedPtr< PdfDigitalSignatureDetails > value)
 Setter for get_DigitalSignatureDetails. More...
 
void set_DisplayDocTitle (bool value)
 Setter for get_DisplayDocTitle. More...
 
void set_DmlEffectsRenderingMode (DmlEffectsRenderingMode value) override
 Setter for get_DmlEffectsRenderingMode. More...
 
void set_DownsampleOptions (SharedPtr< DownsampleOptions > value)
 Setter for get_DownsampleOptions. More...
 
void set_EmbedFullFonts (bool value)
 Setter for get_EmbedFullFonts. More...
 
void set_EncryptionDetails (SharedPtr< PdfEncryptionDetails > value)
 Setter for get_EncryptionDetails. More...
 
void set_EscapeUri (bool value)
 Setter for get_EscapeUri. More...
 
void set_ExportDocumentStructure (bool value)
 Setter for get_ExportDocumentStructure. More...
 
void set_FontEmbeddingMode (PdfFontEmbeddingMode value)
 Setter for get_FontEmbeddingMode. More...
 
void set_HeaderFooterBookmarksExportMode (HeaderFooterBookmarksExportMode value)
 Setter for get_HeaderFooterBookmarksExportMode. More...
 
void set_ImageColorSpaceExportMode (PdfImageColorSpaceExportMode value)
 Setter for get_ImageColorSpaceExportMode. More...
 
void set_ImageCompression (PdfImageCompression value)
 Setter for get_ImageCompression. More...
 
void set_InterpolateImages (bool value)
 Setter for get_InterpolateImages. More...
 
void set_JpegQuality (int32_t value)
 Setter for get_JpegQuality. More...
 
void set_OpenHyperlinksInNewWindow (bool value)
 Setter for get_OpenHyperlinksInNewWindow. More...
 
void set_PageMode (PdfPageMode value)
 Setter for get_PageMode. More...
 
void set_PreblendImages (bool value)
 Setter for get_PreblendImages. More...
 
void set_PreserveFormFields (bool value)
 Setter for get_PreserveFormFields. More...
 
void set_SaveFormat (SaveFormat value) override
 Setter for get_SaveFormat. More...
 
void set_TextCompression (PdfTextCompression value)
 Setter for get_TextCompression. More...
 
void set_UseBookFoldPrintingSettings (bool value)
 Setter for get_UseBookFoldPrintingSettings. More...
 
void set_UseCoreFonts (bool value)
 Setter for get_UseCoreFonts. More...
 
void set_ZoomBehavior (PdfZoomBehavior value)
 Setter for get_ZoomBehavior. More...
 
void set_ZoomFactor (int32_t value)
 Setter for get_ZoomFactor. More...
 
- Public Member Functions inherited from FixedPageSaveOptions
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...
 
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...
 
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...
 
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...
 
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...
 
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 FixedPageSaveOptions
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
 

Constructor & Destructor Documentation

◆ PdfSaveOptions()

Aspose::Words::Saving::PdfSaveOptions::PdfSaveOptions ( )

Initializes a new instance of this class that can be used to save a document in the Pdf format.

Examples

Demonstrates how to set Aspose.Words to embed full fonts in the output PDF document.

// Load the document to render
auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
// Aspose.Words embeds full fonts by default when EmbedFullFonts is set to true
// The property below can be changed each time a document is rendered
auto options = MakeObject<PdfSaveOptions>();
options->set_EmbedFullFonts(true);
// The output PDF will be embedded with all fonts found in the document
doc->Save(ArtifactsDir + u"Rendering.EmbedFullFonts.pdf", options);

Member Function Documentation

◆ Clone()

System::SharedPtr<Aspose::Words::Saving::PdfSaveOptions> Aspose::Words::Saving::PdfSaveOptions::Clone ( )

Creates a deep clone of this object.

Examples

Shows how to update fields before saving into a PDF document.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Insert two pages of text, including two fields that will need to be updated to display an accurate value
builder->Write(u"Page ");
builder->InsertField(u"PAGE", u"");
builder->Write(u" of ");
builder->InsertField(u"NUMPAGES", u"");
builder->Writeln(u"Hello World!");
auto options = MakeObject<PdfSaveOptions>();
options->set_UpdateFields(doUpdateFields);
// PdfSaveOptions objects can be cloned
ASPOSE_ASSERT_NS(options, options->Clone());
doc->Save(ArtifactsDir + u"PdfSaveOptions.UpdateFields.pdf", options);

◆ get_AdditionalTextPositioning()

bool Aspose::Words::Saving::PdfSaveOptions::get_AdditionalTextPositioning ( ) const

A flag specifying whether to write additional text positioning operators or not.

If true, additional text positioning operators are written to the output PDF. This may help to overcome issues with inaccurate text positioning with some printers. The downside is the increased PDF document size.

The default value is false.

Examples

Show how to write additional text positioning operators.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
// This may help to overcome issues with inaccurate text positioning with some printers, even if the PDF looks fine,
// but the file size will increase due to higher text positioning precision used
auto saveOptions = MakeObject<PdfSaveOptions>();
saveOptions->set_AdditionalTextPositioning(applyAdditionalTextPositioning);
saveOptions->set_TextCompression(Aspose::Words::Saving::PdfTextCompression::None);
doc->Save(ArtifactsDir + u"PdfSaveOptions.AdditionalTextPositioning.pdf", saveOptions);

◆ get_Compliance()

Aspose::Words::Saving::PdfCompliance Aspose::Words::Saving::PdfSaveOptions::get_Compliance ( )

Specifies the PDF standards compliance level for output documents.

Default is Pdf17.

Examples

Shows how to save images to PDF using JPEG encoding to decrease file size.

auto doc = MakeObject<Document>(MyDir + u"Images.docx");
auto pdfSaveOptions = MakeObject<PdfSaveOptions>();
pdfSaveOptions->set_ImageCompression(Aspose::Words::Saving::PdfImageCompression::Jpeg);
pdfSaveOptions->get_DownsampleOptions()->set_DownsampleImages(false);
doc->Save(ArtifactsDir + u"PdfSaveOptions.ImageCompression.pdf", pdfSaveOptions);
auto pdfSaveOptionsA1B = MakeObject<PdfSaveOptions>();
pdfSaveOptionsA1B->set_Compliance(Aspose::Words::Saving::PdfCompliance::PdfA1b);
pdfSaveOptionsA1B->set_ImageCompression(Aspose::Words::Saving::PdfImageCompression::Jpeg);
pdfSaveOptionsA1B->get_DownsampleOptions()->set_DownsampleImages(false);
// Use JPEG compression at 50% quality to reduce file size
pdfSaveOptionsA1B->set_JpegQuality(100);
pdfSaveOptionsA1B->set_ImageColorSpaceExportMode(Aspose::Words::Saving::PdfImageColorSpaceExportMode::SimpleCmyk);
doc->Save(ArtifactsDir + u"PdfSaveOptions.ImageCompression.PDF_A_1_B.pdf", pdfSaveOptionsA1B);
auto pdfSaveOptionsA1A = MakeObject<PdfSaveOptions>();
pdfSaveOptionsA1A->set_Compliance(Aspose::Words::Saving::PdfCompliance::PdfA1a);
pdfSaveOptionsA1A->set_ExportDocumentStructure(true);
pdfSaveOptionsA1A->set_ImageCompression(Aspose::Words::Saving::PdfImageCompression::Jpeg);
pdfSaveOptionsA1A->get_DownsampleOptions()->set_DownsampleImages(false);
doc->Save(ArtifactsDir + u"PdfSaveOptions.ImageCompression.PDF_A_1_A.pdf", pdfSaveOptionsA1A);

◆ get_CreateNoteHyperlinks()

bool Aspose::Words::Saving::PdfSaveOptions::get_CreateNoteHyperlinks ( ) const

Specifies whether to convert footnote/endnote references in main text story into active hyperlinks. When clicked the hyperlink will lead to the corresponding footnote/endnote. Default is false.

Examples

Shows how to make footnotes and endnotes work like hyperlinks.

// Open a document with footnotes/endnotes
auto doc = MakeObject<Document>(MyDir + u"Footnotes and endnotes.docx");
// Creating a PdfSaveOptions instance with this flag set will convert footnote/endnote number symbols in the text
// into hyperlinks pointing to the footnotes, and the actual footnotes/endnotes at the end of pages into links to their
// referenced body text
auto options = MakeObject<PdfSaveOptions>();
options->set_CreateNoteHyperlinks(doCreateHyperlinks);
doc->Save(ArtifactsDir + u"PdfSaveOptions.NoteHyperlinks.pdf", options);

◆ get_CustomPropertiesExport()

Aspose::Words::Saving::PdfCustomPropertiesExport Aspose::Words::Saving::PdfSaveOptions::get_CustomPropertiesExport ( ) const

Gets or sets a value determining the way CustomDocumentProperties are exported to PDF file. Default value is None.

Examples

Shows how to export custom properties while saving to .pdf.

auto doc = MakeObject<Document>();
// Add a custom document property that doesn't use the name of some built in properties
doc->get_CustomDocumentProperties()->Add(u"Company", String(u"My value"));
// Configure the PdfSaveOptions like this will display the properties
// in the "Document Properties" menu of Adobe Acrobat Pro
auto options = MakeObject<PdfSaveOptions>();
options->set_CustomPropertiesExport(pdfCustomPropertiesExportMode);
doc->Save(ArtifactsDir + u"PdfSaveOptions.CustomPropertiesExport.pdf", options);

◆ get_DigitalSignatureDetails()

System::SharedPtr<Aspose::Words::Saving::PdfDigitalSignatureDetails> Aspose::Words::Saving::PdfSaveOptions::get_DigitalSignatureDetails ( ) const

Gets or sets the details for signing the output PDF document.

At the moment digitally signing PDF documents is only available on .NET 2.0 or higher.

The default value is null and the output document will not be signed. When this property is set to a valid PdfDigitalSignatureDetails object, then the output PDF document will be digitally signed.

Examples

Shows how to sign a generated PDF using Aspose.Words.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->Writeln(u"Signed PDF contents.");
// Load the certificate from disk
// The other constructor overloads can be used to load certificates from different locations
SharedPtr<CertificateHolder> certificateHolder = CertificateHolder::Create(MyDir + u"morzal.pfx", u"aw");
// Pass the certificate and details to the save options class to sign with
auto options = MakeObject<PdfSaveOptions>();
options->set_DigitalSignatureDetails(MakeObject<PdfDigitalSignatureDetails>(certificateHolder, u"Test Signing", u"Aspose Office", signingTime));
// We can use this attribute to set a different hash algorithm
options->get_DigitalSignatureDetails()->set_HashAlgorithm(Aspose::Words::Saving::PdfDigitalSignatureHashAlgorithm::Sha256);
ASSERT_EQ(u"Test Signing", options->get_DigitalSignatureDetails()->get_Reason());
ASSERT_EQ(u"Aspose Office", options->get_DigitalSignatureDetails()->get_Location());
ASSERT_EQ(signingTime.ToUniversalTime(), options->get_DigitalSignatureDetails()->get_SignatureDate());
doc->Save(ArtifactsDir + u"PdfSaveOptions.PdfDigitalSignature.pdf", options);

◆ get_DisplayDocTitle()

bool Aspose::Words::Saving::PdfSaveOptions::get_DisplayDocTitle ( ) const

A flag specifying whether the window’s title bar should display the document title taken from the Title entry of the document information dictionary.

If false, the title bar should instead display the name of the PDF file containing the document.

The default value is false.

Examples

Shows how to display title of the document as title bar.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
doc->get_BuiltInDocumentProperties()->set_Title(u"Windows bar pdf title");
auto pdfSaveOptions = MakeObject<PdfSaveOptions>();
pdfSaveOptions->set_DisplayDocTitle(true);
doc->Save(ArtifactsDir + u"PdfSaveOptions.WindowsBarPdfTitle.pdf", pdfSaveOptions);

◆ get_DmlEffectsRenderingMode()

Aspose::Words::Saving::DmlEffectsRenderingMode Aspose::Words::Saving::PdfSaveOptions::get_DmlEffectsRenderingMode ( )
overridevirtual

Gets or sets a value determining how DrawingML effects are rendered.

The default value is Simplified.

This property is used when the document is exported to fixed page formats.

If Compliance is set to PdfA1a or PdfA1b, property always returns None.

Examples

Shows how to configure DrawingML rendering quality with PdfSaveOptions.

auto doc = MakeObject<Document>(MyDir + u"DrawingML shape effects.docx");
auto options = MakeObject<PdfSaveOptions>();
options->set_DmlEffectsRenderingMode(effectsRenderingMode);
ASSERT_EQ(Aspose::Words::Saving::DmlRenderingMode::DrawingML, options->get_DmlRenderingMode());
doc->Save(ArtifactsDir + u"PdfSaveOptions.DrawingMLEffects.pdf", options);

Reimplemented from Aspose::Words::Saving::SaveOptions.

◆ get_DownsampleOptions()

System::SharedPtr<Aspose::Words::Saving::DownsampleOptions> Aspose::Words::Saving::PdfSaveOptions::get_DownsampleOptions ( ) const

Allows to specify downsample options.

Examples

Shows how to change the resolution of images in output pdf documents.

// Open a document that contains images
auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
doc->Save(ArtifactsDir + u"Document.DownsampleOptions.Default.pdf");
// If we want to convert the document to .pdf, we can use a SaveOptions implementation to customize the saving process
auto options = MakeObject<PdfSaveOptions>();
// This conversion will downsample images by default
ASSERT_TRUE(options->get_DownsampleOptions()->get_DownsampleImages());
ASSERT_EQ(220, options->get_DownsampleOptions()->get_Resolution());
// We can set the output resolution to a different value
// The first two images in the input document will be affected by this
options->get_DownsampleOptions()->set_Resolution(36);
// We can set a minimum threshold for downsampling
// This value will prevent some images in the input document from being downsampled
options->get_DownsampleOptions()->set_ResolutionThreshold(128);
doc->Save(ArtifactsDir + u"Document.DownsampleOptions.LowerThreshold.pdf", options);

◆ get_EmbedFullFonts()

bool Aspose::Words::Saving::PdfSaveOptions::get_EmbedFullFonts ( ) const

Controls how fonts are embedded into the resulting PDF documents.

The default value is false, which means the fonts are subsetted before embedding. Subsetting is useful if you want to keep the output file size smaller. Subsetting removes all unused glyphs from a font.

When this value is set to true, a complete font file is embedded into PDF without subsetting. This will result in larger output files, but can be a useful option when you want to edit the resulting PDF later (e.g. add more text).

Some fonts are large (several megabytes) and embedding them without subsetting will result in large output documents.

Examples

Demonstrates how to set Aspose.Words to embed full fonts in the output PDF document.

// Load the document to render
auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
// Aspose.Words embeds full fonts by default when EmbedFullFonts is set to true
// The property below can be changed each time a document is rendered
auto options = MakeObject<PdfSaveOptions>();
options->set_EmbedFullFonts(true);
// The output PDF will be embedded with all fonts found in the document
doc->Save(ArtifactsDir + u"Rendering.EmbedFullFonts.pdf", options);

Demonstrates how to set Aspose.Words to subset fonts in the output PDF.

// Load the document to render
auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
// To subset fonts in the output PDF document, simply create new PdfSaveOptions and set EmbedFullFonts to false
auto options = MakeObject<PdfSaveOptions>();
options->set_EmbedFullFonts(false);
// The output PDF will contain subsets of the fonts in the document
// Only the glyphs used in the document are included in the PDF fonts
doc->Save(ArtifactsDir + u"Rendering.SubsetFonts.pdf", options);

◆ get_EncryptionDetails()

System::SharedPtr<Aspose::Words::Saving::PdfEncryptionDetails> Aspose::Words::Saving::PdfSaveOptions::get_EncryptionDetails ( ) const

Gets or sets the details for encrypting the output PDF document.

The default value is null and the output document will not be encrypted. When this property is set to a valid PdfEncryptionDetails object, then the output PDF document will be encrypted.

Note that encryption cannot be used when PDF/A compliance is set as this compliance does not permit encryption.");

Examples

Demonstrates how to set permissions on a PDF document generated by Aspose.Words.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
auto saveOptions = MakeObject<PdfSaveOptions>();
// Create encryption details and set owner password
auto encryptionDetails = MakeObject<PdfEncryptionDetails>(u"password", String::Empty, Aspose::Words::Saving::PdfEncryptionAlgorithm::RC4_128);
// Start by disallowing all permissions
encryptionDetails->set_Permissions(Aspose::Words::Saving::PdfPermissions::DisallowAll);
// Extend permissions to allow editing or modifying annotations
saveOptions->set_EncryptionDetails(encryptionDetails);
// Render the document to PDF format with the specified permissions
doc->Save(ArtifactsDir + u"Rendering.EncryptionPermissions.pdf", saveOptions);

◆ get_EscapeUri()

bool Aspose::Words::Saving::PdfSaveOptions::get_EscapeUri ( ) const

A flag specifying whether URI should be escaped before writing.

Note that if this option is set to false hyperlinks are written "as is", so valid (escaped) URI should be provided in document's model.

The default value is true.

Examples

Shows how to escape hyperlinks in the document.

auto builder = MakeObject<DocumentBuilder>();
builder->InsertHyperlink(u"Testlink", uri, false);
// Set this property to false if you are sure that hyperlinks in document's model are already escaped
auto options = MakeObject<PdfSaveOptions>();
options->set_EscapeUri(isEscaped);
options->set_OpenHyperlinksInNewWindow(true);
builder->get_Document()->Save(ArtifactsDir + u"PdfSaveOptions.EscapedUri.pdf", options);

◆ get_ExportDocumentStructure()

bool Aspose::Words::Saving::PdfSaveOptions::get_ExportDocumentStructure ( ) const

Gets or sets a value determining whether or not to export document structure.

This value is ignored when saving to PDF/A-1a because document structure is required for this compliance.

Note that exporting the document structure significantly increases the memory consumption, especially for the large documents.

Examples

Shows how to convert a .docx to .pdf while preserving the document structure.

auto doc = MakeObject<Document>(MyDir + u"Paragraphs.docx");
// Create a PdfSaveOptions object and configure it to preserve the logical structure that's in the input document
// The file size will be increased and the structure will be visible in the "Content" navigation pane
// of Adobe Acrobat Pro
auto options = MakeObject<PdfSaveOptions>();
options->set_ExportDocumentStructure(doExportStructure);
doc->Save(ArtifactsDir + u"PdfSaveOptions.ExportDocumentStructure.pdf", options);

◆ get_FontEmbeddingMode()

Aspose::Words::Saving::PdfFontEmbeddingMode Aspose::Words::Saving::PdfSaveOptions::get_FontEmbeddingMode ( ) const

Specifies the font embedding mode.

The default value is EmbedAll.

This setting works only for the text in ANSI (Windows-1252) encoding. If the document contains non-ANSI text then corresponding fonts will be embedded regardless of this setting.

Note that when saving to PDF/A this option must be set to EmbedAll as all fonts must be embedded in the PDF file.

Examples

Shows how to set Aspose.Words to skip embedding Arial and Times New Roman fonts into a PDF document.

// Load the document to render
auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
// To disable embedding standard windows font use the PdfSaveOptions and set the EmbedStandardWindowsFonts property to false
auto options = MakeObject<PdfSaveOptions>();
// The output PDF will be saved without embedding standard windows fonts
doc->Save(ArtifactsDir + u"Rendering.DisableEmbedWindowsFonts.pdf", options);

◆ get_HeaderFooterBookmarksExportMode()

Aspose::Words::Saving::HeaderFooterBookmarksExportMode Aspose::Words::Saving::PdfSaveOptions::get_HeaderFooterBookmarksExportMode ( ) const

Determines how bookmarks in headers/footers are exported.

The default value is All.

This property is used in conjunction with the OutlineOptions option.

Examples

Shows how bookmarks in headers/footers are exported to pdf.

auto doc = MakeObject<Document>(MyDir + u"Bookmarks in headers and footers.docx");
// You can specify how bookmarks in headers/footers are exported
// There is a several options for this:
// "None" - Bookmarks in headers/footers are not exported
// "First" - Only bookmark in first header/footer of the section is exported
// "All" - Bookmarks in all headers/footers are exported
auto saveOptions = MakeObject<PdfSaveOptions>();
saveOptions->set_HeaderFooterBookmarksExportMode(headerFooterBookmarksExportMode);
saveOptions->get_OutlineOptions()->set_DefaultBookmarksOutlineLevel(1);
doc->Save(ArtifactsDir + u"PdfSaveOptions.HeaderFooterBookmarksExportMode.pdf", saveOptions);

◆ get_ImageColorSpaceExportMode()

Aspose::Words::Saving::PdfImageColorSpaceExportMode Aspose::Words::Saving::PdfSaveOptions::get_ImageColorSpaceExportMode ( ) const

Specifies how the color space will be selected for the images in PDF document.

Examples

Shows how to save images to PDF using JPEG encoding to decrease file size.

auto doc = MakeObject<Document>(MyDir + u"Images.docx");
auto pdfSaveOptions = MakeObject<PdfSaveOptions>();
pdfSaveOptions->set_ImageCompression(Aspose::Words::Saving::PdfImageCompression::Jpeg);
pdfSaveOptions->get_DownsampleOptions()->set_DownsampleImages(false);
doc->Save(ArtifactsDir + u"PdfSaveOptions.ImageCompression.pdf", pdfSaveOptions);
auto pdfSaveOptionsA1B = MakeObject<PdfSaveOptions>();
pdfSaveOptionsA1B->set_Compliance(Aspose::Words::Saving::PdfCompliance::PdfA1b);
pdfSaveOptionsA1B->set_ImageCompression(Aspose::Words::Saving::PdfImageCompression::Jpeg);
pdfSaveOptionsA1B->get_DownsampleOptions()->set_DownsampleImages(false);
// Use JPEG compression at 50% quality to reduce file size
pdfSaveOptionsA1B->set_JpegQuality(100);
pdfSaveOptionsA1B->set_ImageColorSpaceExportMode(Aspose::Words::Saving::PdfImageColorSpaceExportMode::SimpleCmyk);
doc->Save(ArtifactsDir + u"PdfSaveOptions.ImageCompression.PDF_A_1_B.pdf", pdfSaveOptionsA1B);
auto pdfSaveOptionsA1A = MakeObject<PdfSaveOptions>();
pdfSaveOptionsA1A->set_Compliance(Aspose::Words::Saving::PdfCompliance::PdfA1a);
pdfSaveOptionsA1A->set_ExportDocumentStructure(true);
pdfSaveOptionsA1A->set_ImageCompression(Aspose::Words::Saving::PdfImageCompression::Jpeg);
pdfSaveOptionsA1A->get_DownsampleOptions()->set_DownsampleImages(false);
doc->Save(ArtifactsDir + u"PdfSaveOptions.ImageCompression.PDF_A_1_A.pdf", pdfSaveOptionsA1A);

◆ get_ImageCompression()

Aspose::Words::Saving::PdfImageCompression Aspose::Words::Saving::PdfSaveOptions::get_ImageCompression ( ) const

Specifies compression type to be used for all images in the document.

Default is Auto.

Using Jpeg lets you control the quality of images in the output document through the JpegQuality property.

Using Jpeg provides the fastest conversion speed when compared to the performance of other compression types, but in this case, there is lossy JPEG compression.

Using Auto lets to control the quality of Jpeg in the output document through the JpegQuality property, but for other formats, raw pixel data is extracted and saved with Flate compression. This case is slower than Jpeg conversion but lossless.

Examples

Shows how to save images to PDF using JPEG encoding to decrease file size.

auto doc = MakeObject<Document>(MyDir + u"Images.docx");
auto pdfSaveOptions = MakeObject<PdfSaveOptions>();
pdfSaveOptions->set_ImageCompression(Aspose::Words::Saving::PdfImageCompression::Jpeg);
pdfSaveOptions->get_DownsampleOptions()->set_DownsampleImages(false);
doc->Save(ArtifactsDir + u"PdfSaveOptions.ImageCompression.pdf", pdfSaveOptions);
auto pdfSaveOptionsA1B = MakeObject<PdfSaveOptions>();
pdfSaveOptionsA1B->set_Compliance(Aspose::Words::Saving::PdfCompliance::PdfA1b);
pdfSaveOptionsA1B->set_ImageCompression(Aspose::Words::Saving::PdfImageCompression::Jpeg);
pdfSaveOptionsA1B->get_DownsampleOptions()->set_DownsampleImages(false);
// Use JPEG compression at 50% quality to reduce file size
pdfSaveOptionsA1B->set_JpegQuality(100);
pdfSaveOptionsA1B->set_ImageColorSpaceExportMode(Aspose::Words::Saving::PdfImageColorSpaceExportMode::SimpleCmyk);
doc->Save(ArtifactsDir + u"PdfSaveOptions.ImageCompression.PDF_A_1_B.pdf", pdfSaveOptionsA1B);
auto pdfSaveOptionsA1A = MakeObject<PdfSaveOptions>();
pdfSaveOptionsA1A->set_Compliance(Aspose::Words::Saving::PdfCompliance::PdfA1a);
pdfSaveOptionsA1A->set_ExportDocumentStructure(true);
pdfSaveOptionsA1A->set_ImageCompression(Aspose::Words::Saving::PdfImageCompression::Jpeg);
pdfSaveOptionsA1A->get_DownsampleOptions()->set_DownsampleImages(false);
doc->Save(ArtifactsDir + u"PdfSaveOptions.ImageCompression.PDF_A_1_A.pdf", pdfSaveOptionsA1A);

◆ get_InterpolateImages()

bool Aspose::Words::Saving::PdfSaveOptions::get_InterpolateImages ( ) const

A flag indicating whether image interpolation shall be performed by a conforming reader. When false is specified, the flag is not written to the output document and the default behaviour of reader is used instead.

When the resolution of a source image is significantly lower than that of the output device, each source sample covers many device pixels. As a result, images can appear jaggy or blocky. These visual artifacts can be reduced by applying an image interpolation algorithm during rendering. Instead of painting all pixels covered by a source sample with the same color, image interpolation attempts to produce a smooth transition between adjacent sample values.

A conforming Reader may choose to not implement this feature of PDF, or may use any specific implementation of interpolation that it wishes.

The default value is false.

◆ get_JpegQuality()

int32_t Aspose::Words::Saving::PdfSaveOptions::get_JpegQuality ( )

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

The default value is 100.

This property is used in conjunction with the ImageCompression option.

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 PDF 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. If quality is 100 and source image is JPEG, it means no compression - original bytes will be saved.

Examples

Shows how to save images to PDF using JPEG encoding to decrease file size.

auto doc = MakeObject<Document>(MyDir + u"Images.docx");
auto pdfSaveOptions = MakeObject<PdfSaveOptions>();
pdfSaveOptions->set_ImageCompression(Aspose::Words::Saving::PdfImageCompression::Jpeg);
pdfSaveOptions->get_DownsampleOptions()->set_DownsampleImages(false);
doc->Save(ArtifactsDir + u"PdfSaveOptions.ImageCompression.pdf", pdfSaveOptions);
auto pdfSaveOptionsA1B = MakeObject<PdfSaveOptions>();
pdfSaveOptionsA1B->set_Compliance(Aspose::Words::Saving::PdfCompliance::PdfA1b);
pdfSaveOptionsA1B->set_ImageCompression(Aspose::Words::Saving::PdfImageCompression::Jpeg);
pdfSaveOptionsA1B->get_DownsampleOptions()->set_DownsampleImages(false);
// Use JPEG compression at 50% quality to reduce file size
pdfSaveOptionsA1B->set_JpegQuality(100);
pdfSaveOptionsA1B->set_ImageColorSpaceExportMode(Aspose::Words::Saving::PdfImageColorSpaceExportMode::SimpleCmyk);
doc->Save(ArtifactsDir + u"PdfSaveOptions.ImageCompression.PDF_A_1_B.pdf", pdfSaveOptionsA1B);
auto pdfSaveOptionsA1A = MakeObject<PdfSaveOptions>();
pdfSaveOptionsA1A->set_Compliance(Aspose::Words::Saving::PdfCompliance::PdfA1a);
pdfSaveOptionsA1A->set_ExportDocumentStructure(true);
pdfSaveOptionsA1A->set_ImageCompression(Aspose::Words::Saving::PdfImageCompression::Jpeg);
pdfSaveOptionsA1A->get_DownsampleOptions()->set_DownsampleImages(false);
doc->Save(ArtifactsDir + u"PdfSaveOptions.ImageCompression.PDF_A_1_A.pdf", pdfSaveOptionsA1A);

◆ get_OpenHyperlinksInNewWindow()

bool Aspose::Words::Saving::PdfSaveOptions::get_OpenHyperlinksInNewWindow ( ) const

Gets or sets a value determining whether hyperlinks in the output Pdf document are forced to be opened in a new window (or tab) of a browser.

The default value is false. When this value is set to true hyperlinks are saved using JavaScript code. JavaScript code is app.launchURL("URL", true);, where URL is a hyperlink.

Note that if this option is set to true hyperlinks can't work in some PDF readers e.g. Chrome, Firefox.

Examples

Shows how to escape hyperlinks in the document.

auto builder = MakeObject<DocumentBuilder>();
builder->InsertHyperlink(u"Testlink", uri, false);
// Set this property to false if you are sure that hyperlinks in document's model are already escaped
auto options = MakeObject<PdfSaveOptions>();
options->set_EscapeUri(isEscaped);
options->set_OpenHyperlinksInNewWindow(true);
builder->get_Document()->Save(ArtifactsDir + u"PdfSaveOptions.EscapedUri.pdf", options);

◆ get_OutlineOptions()

System::SharedPtr<Aspose::Words::Saving::OutlineOptions> Aspose::Words::Saving::PdfSaveOptions::get_OutlineOptions ( ) const

Allows to specify outline options.

Outlines can be created from headings and bookmarks.

For headings outline level is determined by the heading level.

It is possible to set the max heading level to be included into outlines or disable heading outlines at all.

For bookmarks outline level may be set in options as a default value for all bookmarks or as individual values for particular bookmarks.

Also, outlines can be exported to XPS format by using the same OutlineOptions class.

Examples

Shows how to create PDF document outline entries for headings.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Create TOC entries
builder->get_ParagraphFormat()->set_StyleIdentifier(Aspose::Words::StyleIdentifier::Heading1);
ASSERT_TRUE(builder->get_ParagraphFormat()->get_IsHeading());
builder->Writeln(u"Heading 1");
builder->get_ParagraphFormat()->set_StyleIdentifier(Aspose::Words::StyleIdentifier::Heading4);
builder->Writeln(u"Heading 1.1.1.1");
builder->Writeln(u"Heading 1.1.1.2");
builder->get_ParagraphFormat()->set_StyleIdentifier(Aspose::Words::StyleIdentifier::Heading9);
builder->Writeln(u"Heading 1.1.1.1.1.1.1.1.1");
builder->Writeln(u"Heading 1.1.1.1.1.1.1.1.2");
// Create "PdfSaveOptions" with some mandatory parameters
// "HeadingsOutlineLevels" specifies how many levels of headings to include in the document outline
// "CreateMissingOutlineLevels" determining whether or not to create missing heading levels
auto pdfSaveOptions = MakeObject<PdfSaveOptions>();
pdfSaveOptions->get_OutlineOptions()->set_HeadingsOutlineLevels(9);
pdfSaveOptions->get_OutlineOptions()->set_CreateMissingOutlineLevels(true);
pdfSaveOptions->set_SaveFormat(Aspose::Words::SaveFormat::Pdf);
doc->Save(ArtifactsDir + u"PdfSaveOptions.CreateMissingOutlineLevels.pdf", pdfSaveOptions);

◆ get_PageMode()

Aspose::Words::Saving::PdfPageMode Aspose::Words::Saving::PdfSaveOptions::get_PageMode ( ) const

Specifies how the PDF document should be displayed when opened in the PDF reader.

Examples

Shows how bookmarks in headers/footers are exported to pdf.

auto doc = MakeObject<Document>(MyDir + u"Bookmarks in headers and footers.docx");
// You can specify how bookmarks in headers/footers are exported
// There is a several options for this:
// "None" - Bookmarks in headers/footers are not exported
// "First" - Only bookmark in first header/footer of the section is exported
// "All" - Bookmarks in all headers/footers are exported
auto saveOptions = MakeObject<PdfSaveOptions>();
saveOptions->set_HeaderFooterBookmarksExportMode(headerFooterBookmarksExportMode);
saveOptions->get_OutlineOptions()->set_DefaultBookmarksOutlineLevel(1);
doc->Save(ArtifactsDir + u"PdfSaveOptions.HeaderFooterBookmarksExportMode.pdf", saveOptions);

Shows how to set instructions for some PDF readers to follow when opening an output document.

auto doc = MakeObject<Document>(MyDir + u"Document.docx");
auto options = MakeObject<PdfSaveOptions>();
options->set_PageMode(pageMode);
doc->Save(ArtifactsDir + u"PdfSaveOptions.PageMode.pdf", options);

◆ get_PreblendImages()

bool Aspose::Words::Saving::PdfSaveOptions::get_PreblendImages ( ) const

Gets or sets a value determining whether or not to preblend transparent images with black background color.

Preblending images may improve PDF document visual appearance in Adobe Reader and remove anti-aliasing artifacts.

In order to properly display preblended images, PDF viewer application must support /Matte entry in soft-mask image dictionary. Also preblending images may decrease PDF rendering performance.

The default value is false.

Examples

Shows how to preblend images with transparent backgrounds.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<System::Drawing::Image> img = System::Drawing::Image::FromFile(ImageDir + u"Transparent background logo.png");
builder->InsertImage(img);
// Setting this flag in a SaveOptions object may change the quality and size of the output .pdf
// because of the way some images are rendered
auto options = MakeObject<PdfSaveOptions>();
options->set_PreblendImages(doPreblendImages);
doc->Save(ArtifactsDir + u"PdfSaveOptions.PreblendImages.pdf", options);

◆ get_PreserveFormFields()

bool Aspose::Words::Saving::PdfSaveOptions::get_PreserveFormFields ( ) const

Specifies whether to preserve Microsoft Word form fields as form fields in PDF or convert them to text. Default is false.

Microsoft Word form fields include text input, drop down and check box controls.

When set to false, these fields will be exported as text to PDF. When set to true, these fields will be exported as PDF form fields.

When exporting form fields to PDF as form fields, some formatting loss might occur because PDF form fields do not support all features of Microsoft Word form fields.

Also, the output size depends on the content size because editable forms in Microsoft Word are inline objects.

Examples

Shows how to save a document to the PDF format using the Save method and the PdfSaveOptions class.

// Open the document
auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
// Option 1: Save document to file in the PDF format with default options
doc->Save(ArtifactsDir + u"Rendering.PdfDefaultOptions.pdf");
// Option 2: Save the document to stream in the PDF format with default options
auto stream = MakeObject<System::IO::MemoryStream>();
doc->Save(stream, Aspose::Words::SaveFormat::Pdf);
// Rewind the stream position back to the beginning, ready for use
stream->Seek(static_cast<int64_t>(0), System::IO::SeekOrigin::Begin);
// Option 3: Save document to the PDF format with specified options
// Render the first page only and preserve form fields as usable controls and not as plain text
auto pdfOptions = MakeObject<PdfSaveOptions>();
pdfOptions->set_PageIndex(0);
pdfOptions->set_PageCount(1);
pdfOptions->set_PreserveFormFields(true);
doc->Save(ArtifactsDir + u"Rendering.PdfCustomOptions.pdf", pdfOptions);

◆ get_SaveFormat()

Aspose::Words::SaveFormat Aspose::Words::Saving::PdfSaveOptions::get_SaveFormat ( )
overridevirtual

Specifies the format in which the document will be saved if this save options object is used. Can only be Pdf.

Examples

Shows how to create PDF document outline entries for headings.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Create TOC entries
builder->get_ParagraphFormat()->set_StyleIdentifier(Aspose::Words::StyleIdentifier::Heading1);
ASSERT_TRUE(builder->get_ParagraphFormat()->get_IsHeading());
builder->Writeln(u"Heading 1");
builder->get_ParagraphFormat()->set_StyleIdentifier(Aspose::Words::StyleIdentifier::Heading4);
builder->Writeln(u"Heading 1.1.1.1");
builder->Writeln(u"Heading 1.1.1.2");
builder->get_ParagraphFormat()->set_StyleIdentifier(Aspose::Words::StyleIdentifier::Heading9);
builder->Writeln(u"Heading 1.1.1.1.1.1.1.1.1");
builder->Writeln(u"Heading 1.1.1.1.1.1.1.1.2");
// Create "PdfSaveOptions" with some mandatory parameters
// "HeadingsOutlineLevels" specifies how many levels of headings to include in the document outline
// "CreateMissingOutlineLevels" determining whether or not to create missing heading levels
auto pdfSaveOptions = MakeObject<PdfSaveOptions>();
pdfSaveOptions->get_OutlineOptions()->set_HeadingsOutlineLevels(9);
pdfSaveOptions->get_OutlineOptions()->set_CreateMissingOutlineLevels(true);
pdfSaveOptions->set_SaveFormat(Aspose::Words::SaveFormat::Pdf);
doc->Save(ArtifactsDir + u"PdfSaveOptions.CreateMissingOutlineLevels.pdf", pdfSaveOptions);

Implements Aspose::Words::Saving::SaveOptions.

◆ get_TextCompression()

Aspose::Words::Saving::PdfTextCompression Aspose::Words::Saving::PdfSaveOptions::get_TextCompression ( ) const

Specifies compression type to be used for all textual content in the document.

Default is Flate.

Significantly increases output size when saving a document without compression.

Examples

Saves a document to PDF without compression.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
auto options = MakeObject<PdfSaveOptions>();
doc->Save(ArtifactsDir + u"Rendering.SaveToPdfNoCompression.pdf", options);

◆ get_UseBookFoldPrintingSettings()

bool Aspose::Words::Saving::PdfSaveOptions::get_UseBookFoldPrintingSettings ( ) const

Gets or sets a boolean value indicating whether the document should be saved using a booklet printing layout, if it is specified via MultiplePages.

If this option is specified, PageSet, PageIndex and PageCount are ignored when saving. This behavior matches MS Word. If book fold printing settings are not specified in page setup, this option will have no effect.

Examples

Shows how to save a document to the PDF format in the form of a book fold.

// Open a document with multiple paragraphs
auto doc = MakeObject<Document>(MyDir + u"Paragraphs.docx");
// Configure both page setup and PdfSaveOptions to create a book fold
for (auto s : System::IterateOver<Section>(doc->get_Sections()))
{
s->get_PageSetup()->set_MultiplePages(Aspose::Words::Settings::MultiplePagesType::BookFoldPrinting);
}
auto options = MakeObject<PdfSaveOptions>();
options->set_UseBookFoldPrintingSettings(doRenderTextAsBookfold);
// In order to make a booklet, we will need to print this document, stack the pages
// in the order they come out of the printer and then fold down the middle
doc->Save(ArtifactsDir + u"PdfSaveOptions.SaveAsPdfBookFold.pdf", options);

◆ get_UseCoreFonts()

bool Aspose::Words::Saving::PdfSaveOptions::get_UseCoreFonts ( ) const

Gets or sets a value determining whether or not to substitute TrueType fonts Arial, Times New Roman, Courier New and Symbol with core PDF Type 1 fonts.

The default value is false. When this value is set to true Arial, Times New Roman, Courier New and Symbol fonts are replaced in PDF document with corresponding core Type 1 font.

Core PDF fonts, or their font metrics and suitable substitution fonts, are required to be available to any PDF viewer application.

This setting works only for the text in ANSI (Windows-1252) encoding. Non-ANSI text will be written with embedded TrueType font regardless of this setting.

Settings core fonts to true is not allowed when saving to PDF/A as this compliance requires all fonts to be embedded.

This option has a higher priority then FontEmbeddingMode option.

Examples

Shows how to set Aspose.Words to avoid embedding core fonts and let the reader substitute PDF Type 1 fonts instead.

// Load the document to render
auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
// To disable embedding of core fonts and substitute PDF type 1 fonts set UseCoreFonts to true
auto options = MakeObject<PdfSaveOptions>();
options->set_UseCoreFonts(true);
// The output PDF will not be embedded with core fonts such as Arial, Times New Roman etc.
doc->Save(ArtifactsDir + u"Rendering.DisableEmbedCoreFonts.pdf", options);

◆ get_ZoomBehavior()

Aspose::Words::Saving::PdfZoomBehavior Aspose::Words::Saving::PdfSaveOptions::get_ZoomBehavior ( ) const

Gets or sets a value determining what type of zoom should be applied when a document is opened with a PDF viewer.

Examples

Shows how to set the default zooming of an output PDF to 1/4 of default size.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
auto options = MakeObject<PdfSaveOptions>();
options->set_ZoomFactor(25);
// Upon opening the .pdf with a viewer such as Adobe Acrobat Pro, the zoom level will be at 25% by default,
// with thumbnails for each page to the left
doc->Save(ArtifactsDir + u"PdfSaveOptions.ZoomBehaviour.pdf", options);

◆ get_ZoomFactor()

int32_t Aspose::Words::Saving::PdfSaveOptions::get_ZoomFactor ( ) const

Gets or sets a value determining zoom factor (in percentages) for a document.

Examples

Shows how to set the default zooming of an output PDF to 1/4 of default size.

auto doc = MakeObject<Document>(MyDir + u"Rendering.docx");
auto options = MakeObject<PdfSaveOptions>();
options->set_ZoomFactor(25);
// Upon opening the .pdf with a viewer such as Adobe Acrobat Pro, the zoom level will be at 25% by default,
// with thumbnails for each page to the left
doc->Save(ArtifactsDir + u"PdfSaveOptions.ZoomBehaviour.pdf", options);

◆ GetType()

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

◆ Is()

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

◆ set_AdditionalTextPositioning()

void Aspose::Words::Saving::PdfSaveOptions::set_AdditionalTextPositioning ( bool  value)

◆ set_Compliance()

void Aspose::Words::Saving::PdfSaveOptions::set_Compliance ( Aspose::Words::Saving::PdfCompliance  value)

◆ set_CreateNoteHyperlinks()

void Aspose::Words::Saving::PdfSaveOptions::set_CreateNoteHyperlinks ( bool  value)

◆ set_CustomPropertiesExport()

void Aspose::Words::Saving::PdfSaveOptions::set_CustomPropertiesExport ( Aspose::Words::Saving::PdfCustomPropertiesExport  value)

◆ set_DigitalSignatureDetails()

void Aspose::Words::Saving::PdfSaveOptions::set_DigitalSignatureDetails ( System::SharedPtr< Aspose::Words::Saving::PdfDigitalSignatureDetails value)

◆ set_DisplayDocTitle()

void Aspose::Words::Saving::PdfSaveOptions::set_DisplayDocTitle ( bool  value)

◆ set_DmlEffectsRenderingMode()

void Aspose::Words::Saving::PdfSaveOptions::set_DmlEffectsRenderingMode ( Aspose::Words::Saving::DmlEffectsRenderingMode  value)
overridevirtual

◆ set_DownsampleOptions()

void Aspose::Words::Saving::PdfSaveOptions::set_DownsampleOptions ( System::SharedPtr< Aspose::Words::Saving::DownsampleOptions value)

◆ set_EmbedFullFonts()

void Aspose::Words::Saving::PdfSaveOptions::set_EmbedFullFonts ( bool  value)

◆ set_EncryptionDetails()

void Aspose::Words::Saving::PdfSaveOptions::set_EncryptionDetails ( System::SharedPtr< Aspose::Words::Saving::PdfEncryptionDetails value)

◆ set_EscapeUri()

void Aspose::Words::Saving::PdfSaveOptions::set_EscapeUri ( bool  value)

◆ set_ExportDocumentStructure()

void Aspose::Words::Saving::PdfSaveOptions::set_ExportDocumentStructure ( bool  value)

◆ set_FontEmbeddingMode()

void Aspose::Words::Saving::PdfSaveOptions::set_FontEmbeddingMode ( Aspose::Words::Saving::PdfFontEmbeddingMode  value)

◆ set_HeaderFooterBookmarksExportMode()

void Aspose::Words::Saving::PdfSaveOptions::set_HeaderFooterBookmarksExportMode ( Aspose::Words::Saving::HeaderFooterBookmarksExportMode  value)

◆ set_ImageColorSpaceExportMode()

void Aspose::Words::Saving::PdfSaveOptions::set_ImageColorSpaceExportMode ( Aspose::Words::Saving::PdfImageColorSpaceExportMode  value)

◆ set_ImageCompression()

void Aspose::Words::Saving::PdfSaveOptions::set_ImageCompression ( Aspose::Words::Saving::PdfImageCompression  value)

◆ set_InterpolateImages()

void Aspose::Words::Saving::PdfSaveOptions::set_InterpolateImages ( bool  value)

◆ set_JpegQuality()

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

◆ set_OpenHyperlinksInNewWindow()

void Aspose::Words::Saving::PdfSaveOptions::set_OpenHyperlinksInNewWindow ( bool  value)

◆ set_PageMode()

void Aspose::Words::Saving::PdfSaveOptions::set_PageMode ( Aspose::Words::Saving::PdfPageMode  value)

◆ set_PreblendImages()

void Aspose::Words::Saving::PdfSaveOptions::set_PreblendImages ( bool  value)

◆ set_PreserveFormFields()

void Aspose::Words::Saving::PdfSaveOptions::set_PreserveFormFields ( bool  value)

◆ set_SaveFormat()

void Aspose::Words::Saving::PdfSaveOptions::set_SaveFormat ( Aspose::Words::SaveFormat  value)
overridevirtual

◆ set_TextCompression()

void Aspose::Words::Saving::PdfSaveOptions::set_TextCompression ( Aspose::Words::Saving::PdfTextCompression  value)

◆ set_UseBookFoldPrintingSettings()

void Aspose::Words::Saving::PdfSaveOptions::set_UseBookFoldPrintingSettings ( bool  value)

◆ set_UseCoreFonts()

void Aspose::Words::Saving::PdfSaveOptions::set_UseCoreFonts ( bool  value)

◆ set_ZoomBehavior()

void Aspose::Words::Saving::PdfSaveOptions::set_ZoomBehavior ( Aspose::Words::Saving::PdfZoomBehavior  value)

◆ set_ZoomFactor()

void Aspose::Words::Saving::PdfSaveOptions::set_ZoomFactor ( int32_t  value)

◆ Type()

static const System::TypeInfo& Aspose::Words::Saving::PdfSaveOptions::Type ( )
static
@ RC4_128
RC4 encryption, key length of 128 bits.
String
@ Pdf
Saves the document as PDF (Adobe Portable Document) format.
@ PageBreak
Explicit page break.
@ Heading4
The Heading 4 style.
@ DrawingML
Aspose.Words ignores fall-back shape of DrawingML and renders DrawingML itself. This is the default m...
static ASPOSECPP_SHARED_API DateTime get_Now()
@ Jpeg
Jpeg compression. Does not support transparency.
ASPOSECPP_SHARED_API DateTime ToUniversalTime() const
@ DocumentAssembly
Allows assembling the document: inserting, rotating, or deleting pages and creating navigation elemen...
static ASPOSECPP_SHARED_API SharedPtr< Image > FromFile(const String &filename, bool use_embedded_color_management=false)
@ SimpleCmyk
Aspose.Words coverts RGB images to CMYK color space using simple formula.
@ Heading1
The Heading 1 style.
@ DisallowAll
Disallows all operations on the PDF document. This is the default value.
@ ZoomFactor
Displays the page using the specified zoom factor.
@ BookFoldPrinting
Specifies whether to print the document as a book fold.
@ PdfA1a
The output file will comply with the PDF/A-1a standard. This level includes all the requirements of P...
@ ModifyAnnotations
Allows adding or modifying text annotations. When using RC4 40-bit encryption, this option also allow...
@ Sha256
SHA-256 hash algorithm.
@ PdfA1b
The output file will comply with the PDF/A-1b standard. PDF/A-1b has the objective of ensuring reliab...
static System::SharedPtr< Aspose::Words::CertificateHolder > Create(System::ArrayPtr< uint8_t > certBytes, System::SharedPtr< System::Security::SecureString > password)
Creates CertificateHolder object using byte array of PKCS12 store and its password.
@ Begin
@ None
No compression.
@ UseOutlines
Document outline is visible. Note that if there're no outlines in the PDF document then outline navig...
@ Grayscale
Rendering with colors in a range of gray shades from white to black.
@ EmbedNone
Aspose.Words do not embed any fonts.
@ Heading9
The Heading 9 style.