PdfSaveOptions Class

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

ExpandedInheritance Hierarchy

Namespace:  Aspose.Words.Saving
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 21.5.0

ExpandedSyntax

public class PdfSaveOptions : FixedPageSaveOptions

The PdfSaveOptions type exposes the following members.

ExpandedConstructors

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

ExpandedProperties

  NameDescription
Public propertyCode exampleAdditionalTextPositioning
A flag specifying whether to write additional text positioning operators or not.
Public propertyCode exampleAllowEmbeddingPostScriptFonts
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.
(Inherited from SaveOptions.)
Public propertyCode exampleColorMode
Gets or sets a value determining how colors are rendered.
(Inherited from FixedPageSaveOptions.)
Public propertyCode exampleCompliance
Specifies the PDF standards compliance level for output documents.
Public propertyCode exampleCreateNoteHyperlinks
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.
Public propertyCode exampleCustomPropertiesExport
Gets or sets a value determining the way CustomDocumentProperties are exported to PDF file. Default value is None.
Public propertyCustomTimeZoneInfo
Gets or sets custom local time zone used for date/time fields.
(Inherited from SaveOptions.)
Public propertyCode exampleDefaultTemplate
Gets or sets path to default template (including filename). Default value for this property is empty string (Empty).
(Inherited from SaveOptions.)
Public propertyCode exampleDigitalSignatureDetails
Gets or sets the details for signing the output PDF document.
Public propertyCode exampleDisplayDocTitle
A flag specifying whether the window’s title bar should display the document title taken from the Title entry of the document information dictionary.
Public propertyDml3DEffectsRenderingMode
Gets or sets a value determining how 3D effects are rendered.
(Inherited from SaveOptions.)
Public propertyCode exampleDmlEffectsRenderingMode
Gets or sets a value determining how DrawingML effects are rendered.
(Overrides SaveOptionsDmlEffectsRenderingMode.)
Public propertyCode exampleDmlRenderingMode
Gets or sets a value determining how DrawingML shapes are rendered.
(Inherited from SaveOptions.)
Public propertyCode exampleDownsampleOptions
Allows to specify downsample options.
Public propertyCode exampleEmbedFullFonts
Controls how fonts are embedded into the resulting PDF documents.
Public propertyCode exampleEncryptionDetails
Gets or sets the details for encrypting the output PDF document.
Public propertyCode exampleExportDocumentStructure
Gets or sets a value determining whether or not to export document structure.
Public propertyCode exampleFontEmbeddingMode
Specifies the font embedding mode.
Public propertyCode exampleHeaderFooterBookmarksExportMode
Determines how bookmarks in headers/footers are exported.
Public propertyCode exampleImageColorSpaceExportMode
Specifies how the color space will be selected for the images in PDF document.
Public propertyCode exampleImageCompression
Specifies compression type to be used for all images in the document.
Public propertyCode exampleInterpolateImages
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.
Public propertyCode exampleJpegQuality
Gets or sets a value determining the quality of the JPEG images inside PDF document.
Public propertyCode exampleMemoryOptimization
Gets or sets value determining if memory optimization should be performed before saving the document. Default value for this property is false.
(Inherited from SaveOptions.)
Public propertyCode exampleMetafileRenderingOptions
Allows to specify metafile rendering options.
(Inherited from FixedPageSaveOptions.)
Public propertyCode exampleNumeralFormat
Gets or sets NumeralFormat used for rendering of numerals. European numerals are used by default.
(Inherited from FixedPageSaveOptions.)
Public propertyCode exampleOpenHyperlinksInNewWindow
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.
Public propertyCode exampleOptimizeOutput
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.
(Inherited from FixedPageSaveOptions.)
Public propertyCode exampleOutlineOptions
Allows to specify outline options.
Public propertyCode examplePageMode
Specifies how the PDF document should be displayed when opened in the PDF reader.
Public propertyCode examplePageSavingCallback
Allows to control how separate pages are saved when a document is exported to fixed page format.
(Inherited from FixedPageSaveOptions.)
Public propertyCode examplePageSet
Gets or sets the pages to render. Default is all the pages in the document.
(Inherited from FixedPageSaveOptions.)
Public propertyCode examplePreblendImages
Gets or sets a value determining whether or not to preblend transparent images with black background color.
Public propertyCode examplePreserveFormFields
Specifies whether to preserve Microsoft Word form fields as form fields in PDF or convert them to text. Default is false.
Public propertyCode examplePrettyFormat
When true, pretty formats output where applicable. Default value is false.
(Inherited from SaveOptions.)
Public propertyCode exampleSaveFormat
Specifies the format in which the document will be saved if this save options object is used. Can only be Pdf.
(Overrides SaveOptionsSaveFormat.)
Public propertyCode exampleTempFolder
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.
(Inherited from SaveOptions.)
Public propertyCode exampleTextCompression
Specifies compression type to be used for all textual content in the document.
Public propertyUpdateCreatedTimeProperty
Gets or sets a value determining whether the CreatedTime property is updated before saving. Default value is false;
(Inherited from SaveOptions.)
Public propertyCode exampleUpdateFields
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.
(Inherited from SaveOptions.)
Public propertyCode exampleUpdateLastPrintedProperty
Gets or sets a value determining whether the LastPrinted property is updated before saving.
(Inherited from SaveOptions.)
Public propertyCode exampleUpdateLastSavedTimeProperty
Gets or sets a value determining whether the LastSavedTime property is updated before saving.
(Inherited from SaveOptions.)
Public propertyCode exampleUpdateSdtContent
Gets or sets value determining whether content of StructuredDocumentTag is updated before saving.
(Inherited from SaveOptions.)
Public propertyCode exampleUseAntiAliasing
Gets or sets a value determining whether or not to use anti-aliasing for rendering.
(Inherited from SaveOptions.)
Public propertyCode exampleUseBookFoldPrintingSettings
Gets or sets a boolean value indicating whether the document should be saved using a booklet printing layout, if it is specified via MultiplePages.
Public propertyCode exampleUseCoreFonts
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.
Public propertyCode exampleUseHighQualityRendering
Gets or sets a value determining whether or not to use high quality (i.e. slow) rendering algorithms.
(Inherited from SaveOptions.)
Public propertyCode exampleZoomBehavior
Gets or sets a value determining what type of zoom should be applied when a document is opened with a PDF viewer.
Public propertyCode exampleZoomFactor
Gets or sets a value determining zoom factor (in percentages) for a document.

ExpandedMethods

  NameDescription
Public methodCode exampleClone
Creates a deep clone of this object.
Public methodEquals
Determines whether the specified object is equal in value to the current object.
(Inherited from FixedPageSaveOptions.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)

ExpandedExamples

Shows how to change image color with saving options property.
Document doc = new Document(MyDir + "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.
// Set the "ColorMode" property to "Grayscale" to render all images from the document in black and white.
// The size of the output document may be larger with this setting.
// Set the "ColorMode" property to "Normal" to render all images in color.
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions { ColorMode = colorMode };

doc.Save(ArtifactsDir + "PdfSaveOptions.ColorRendering.pdf", pdfSaveOptions);
Shows how to apply text compression when saving a document to PDF.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

for (int i = 0; i < 100; i++)
    builder.Writeln("Lorem ipsum dolor sit amet, consectetur adipiscing elit, " +
                    "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");

// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
PdfSaveOptions options = new PdfSaveOptions();

// Set the "TextCompression" property to "PdfTextCompression.None" to not apply any
// compression to text when we save the document to PDF.
// Set the "TextCompression" property to "PdfTextCompression.Flate" to apply ZIP compression
// to text when we save the document to PDF. The larger the document, the bigger the impact that this will have.
options.TextCompression = pdfTextCompression;

doc.Save(ArtifactsDir + "PdfSaveOptions.TextCompression.pdf", options);
Shows how to convert a whole document to PDF with three levels in the document outline.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Insert headings of levels 1 to 5.
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;

Assert.True(builder.ParagraphFormat.IsHeading);

builder.Writeln("Heading 1");

builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading2;

builder.Writeln("Heading 1.1");
builder.Writeln("Heading 1.2");

builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading3;

builder.Writeln("Heading 1.2.1");
builder.Writeln("Heading 1.2.2");

builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading4;

builder.Writeln("Heading 1.2.2.1");
builder.Writeln("Heading 1.2.2.2");

builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading5;

builder.Writeln("Heading 1.2.2.2.1");
builder.Writeln("Heading 1.2.2.2.2");

// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
PdfSaveOptions options = new PdfSaveOptions();

// The output PDF document will contain an outline, which is a table of contents that lists headings in the document body.
// Clicking on an entry in this outline will take us to the location of its respective heading.
// Set the "HeadingsOutlineLevels" property to "4" to exclude all headings whose levels are above 4 from the outline.
options.OutlineOptions.HeadingsOutlineLevels = 4;

// If an outline entry has subsequent entries of a higher level inbetween itself and the next entry of the same or lower level,
// an arrow will appear to the left of the entry. This entry is the "owner" of several such "sub-entries".
// In our document, the outline entries from the 5th heading level are sub-entries of the second 4th level outline entry,
// the 4th and 5th heading level entries are sub-entries of the second 3rd level entry, and so on. 
// In the outline, we can click on the arrow of the "owner" entry to collapse/expand all its sub-entries.
// Set the "ExpandedOutlineLevels" property to "2" to automatically expand all heading level 2 and lower outline entries
// and collapse all level and 3 and higher entries when we open the document. 
options.OutlineOptions.ExpandedOutlineLevels = 2;

doc.Save(ArtifactsDir + "PdfSaveOptions.ExpandedOutlineLevels.pdf", options);

ExpandedSee Also