PdfSaveOptions class

PdfSaveOptions class

Can be used to specify additional options when saving a document into the SaveFormat.Pdf format. To learn more, visit the Specify Save Options documentation article.

Inheritance: PdfSaveOptionsFixedPageSaveOptionsSaveOptions

Constructors

NameDescription
PdfSaveOptions()Initializes a new instance of this class that can be used to save a document in the SaveFormat.Pdf format.

Properties

NameDescription
additionalTextPositioningA flag specifying whether to write additional text positioning operators or not.
allowEmbeddingPostScriptFontsGets 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)
attachmentsEmbeddingModeGets or sets a value determining how attachments are embedded to the PDF document.
cacheBackgroundGraphicsGets or sets a value determining whether or not to cache graphics placed in document’s background.
colorModeGets or sets a value determining how colors are rendered.
(Inherited from FixedPageSaveOptions)
complianceSpecifies the PDF standards compliance level for output documents.
createNoteHyperlinksSpecifies 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.
customPropertiesExportGets or sets a value determining the way Document.customDocumentProperties are exported to PDF file.
defaultTemplateGets or sets path to default template (including filename). Default value for this property is empty string .
(Inherited from SaveOptions)
digitalSignatureDetailsGets or sets the details for signing the output PDF document.
displayDocTitleA flag specifying whether the window’s title bar should display the document title taken from the Title entry of the document information dictionary.
dml3DEffectsRenderingModeGets or sets a value determining how 3D effects are rendered.
(Inherited from SaveOptions)
dmlEffectsRenderingModeGets or sets a value determining how DrawingML effects are rendered.
dmlRenderingModeGets or sets a value determining how DrawingML shapes are rendered.
(Inherited from SaveOptions)
downsampleOptionsAllows to specify downsample options.
embedFullFontsControls how fonts are embedded into the resulting PDF documents.
encryptionDetailsGets or sets the details for encrypting the output PDF document.
exportDocumentStructureGets or sets a value determining whether or not to export document structure.
exportGeneratorNameWhen true, causes the name and version of Aspose.Words to be embedded into produced files. Default value is true.
(Inherited from SaveOptions)
exportLanguageToSpanTagGets or sets a value determining whether or not to create a “Span” tag in the document structure to export the text language.
exportParagraphGraphicsToArtifactGets or sets a value determining whether a paragraph graphic should be marked as an artifact.
fontEmbeddingModeSpecifies the font embedding mode.
headerFooterBookmarksExportModeDetermines how bookmarks in headers/footers are exported.
imageColorSpaceExportModeSpecifies how the color space will be selected for the images in PDF document.
imageCompressionSpecifies compression type to be used for all images in the document.
imlRenderingModeGets or sets a value determining how ink (InkML) objects are rendered.
(Inherited from SaveOptions)
interpolateImagesA 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.
jpegQualityGets or sets a value determining the quality of the JPEG images inside PDF document.
memoryOptimizationGets or sets value determining if memory optimization should be performed before saving the document. Default value for this property is false.
(Inherited from SaveOptions)
metafileRenderingOptionsAllows to specify metafile rendering options.
(Inherited from FixedPageSaveOptions)
numeralFormatGets or sets NumeralFormat used for rendering of numerals. European numerals are used by default.
(Inherited from FixedPageSaveOptions)
openHyperlinksInNewWindowGets 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.
optimizeOutputFlag 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.
(Inherited from FixedPageSaveOptions)
outlineOptionsAllows to specify outline options.
pageLayoutSpecifies the page layout to be used when the document is opened in a PDF reader.
pageModeSpecifies how the PDF document should be displayed when opened in a PDF reader.
pageSavingCallbackAllows to control how separate pages are saved when a document is exported to fixed page format.
(Inherited from FixedPageSaveOptions)
pageSetGets or sets the pages to render. Default is all the pages in the document.
(Inherited from FixedPageSaveOptions)
preblendImagesGets or sets a value determining whether or not to preblend transparent images with black background color.
preserveFormFieldsSpecifies whether to preserve Microsoft Word form fields as form fields in PDF or convert them to text. Default is false.
prettyFormatWhen true, pretty formats output where applicable. Default value is false.
(Inherited from SaveOptions)
renderChoiceFormFieldBorderSpecifies whether to render PDF choice form field border.
saveFormatSpecifies the format in which the document will be saved if this save options object is used. Can only be SaveFormat.Pdf.
tempFolderSpecifies 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)
textCompressionSpecifies compression type to be used for all textual content in the document.
updateAmbiguousTextFontDetermines whether the font attributes will be changed according to the character code being used.
(Inherited from SaveOptions)
updateCreatedTimePropertyGets or sets a value determining whether the BuiltInDocumentProperties.createdTime property is updated before saving. Default value is false;
(Inherited from SaveOptions)
updateFieldsGets 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)
updateLastPrintedPropertyGets or sets a value determining whether the BuiltInDocumentProperties.lastPrinted property is updated before saving.
(Inherited from SaveOptions)
updateLastSavedTimePropertyGets or sets a value determining whether the BuiltInDocumentProperties.lastSavedTime property is updated before saving.
(Inherited from SaveOptions)
useAntiAliasingGets or sets a value determining whether or not to use anti-aliasing for rendering.
(Inherited from SaveOptions)
useBookFoldPrintingSettingsGets or sets a boolean value indicating whether the document should be saved using a booklet printing layout, if it is specified via PageSetup.multiplePages.
useCoreFontsGets 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.
useHighQualityRenderingGets or sets a value determining whether or not to use high quality (i.e. slow) rendering algorithms.
(Inherited from SaveOptions)
useSdtTagAsFormFieldNameSpecifies whether to use SDT control Tag or Id property as a name of form field in PDF.
zoomBehaviorGets or sets a value determining what type of zoom should be applied when a document is opened with a PDF viewer.
zoomFactorGets or sets a value determining zoom factor (in percentages) for a document.

Methods

NameDescription
clone()Creates a deep clone of this object.
createSaveOptions(saveFormat)Creates a save options object of a class suitable for the specified save format.
(Inherited from SaveOptions)
createSaveOptions(fileName)Creates a save options object of a class suitable for the file extension specified in the given file name.
(Inherited from SaveOptions)

Examples

Shows how to convert a whole document to PDF with three levels in the document outline.

let doc = new aw.Document();
let builder = new aw.DocumentBuilder(doc);

// Insert headings of levels 1 to 5.
builder.paragraphFormat.styleIdentifier = aw.StyleIdentifier.Heading1;

expect(builder.paragraphFormat.isHeading).toEqual(true);

builder.writeln("Heading 1");

builder.paragraphFormat.styleIdentifier = aw.StyleIdentifier.Heading2;

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

builder.paragraphFormat.styleIdentifier = aw.StyleIdentifier.Heading3;

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

builder.paragraphFormat.styleIdentifier = aw.StyleIdentifier.Heading4;

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

builder.paragraphFormat.styleIdentifier = aw.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.
let options = new aw.Saving.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(base.artifactsDir + "PdfSaveOptions.expandedOutlineLevels.pdf", options);

Shows how to apply text compression when saving a document to PDF.

let doc = new aw.Document();
let builder = new aw.DocumentBuilder(doc);

for (let 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.
let options = new aw.Saving.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(base.artifactsDir + "PdfSaveOptions.textCompression.pdf", options);

Shows how to change image color with saving options property.

let doc = new aw.Document(base.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.
let pdfSaveOptions = new aw.Saving.PdfSaveOptions();
pdfSaveOptions.colorMode = colorMode;

doc.save(base.artifactsDir + "PdfSaveOptions.ColorRendering.pdf", pdfSaveOptions);

See Also