PdfSaveOptions

PdfSaveOptions class

Represents the options for saving pdf file.

class PdfSaveOptions extends PaginatedSaveOptions;

Constructors

NameDescription
constructor()Creates the options for saving pdf file.
constructor(PaginatedSaveOptions)Constructs from a parent object convertible to this.

Properties

PropertyTypeDescription
embedStandardWindowsFontsbooleanTrue to embed true type fonts. Affects only ASCII characters 32-127. Fonts for character codes greater than 127 are always embedded. Fonts are always embedded for PDF/A-1a, PDF/A-1b standard. Default is true.
bookmarkPdfBookmarkEntryGets and sets the PdfBookmarkEntry object.
compliancePdfComplianceGets or sets the PDF standards compliance level for output documents.
securityOptionsPdfSecurityOptionsSet this options, when security is need in xls2pdf result.
calculateFormulabooleanIndicates whether to calculate formulas before saving pdf file.
pdfCompressionPdfCompressionCoreIndicate the compression algorithm
createdTimeDateGets and sets the time of generating the pdf document.
producerstringGets and sets producer of generated pdf document.
optimizationTypePdfOptimizationTypeGets and sets pdf optimization type.
customPropertiesExportPdfCustomPropertiesExportGets or sets a value determining the way CustomDocumentPropertyCollection are exported to PDF file. Default value is None.
exportDocumentStructurebooleanIndicates whether to export document structure.
displayDocTitlebooleanIndicates whether the window’s title bar should display the document title.
fontEncodingPdfFontEncodingGets or sets embedded font encoding in pdf.
watermarkRenderingWatermarkGets or sets watermark to output.
embedAttachmentsbooleanIndicates whether to embed attachment for Ole objects in Excel.
saveFormatSaveFormatReadonly. Gets the save file format.
clearDatabooleanMake the workbook empty after saving the file.
cachedFileFolderstringThe folder for temporary files that may be used as data cache.
validateMergedAreasbooleanIndicates whether validate merged cells before saving the file.
mergeAreasbooleanIndicates whether merge the areas of conditional formatting and validation before saving the file.
createDirectorybooleanIf true and the directory does not exist, the directory will be automatically created before saving the file.
sortNamesbooleanIndicates whether sorting defined names before saving file.
sortExternalNamesbooleanIndicates whether sorting external defined names before saving file.
refreshChartCachebooleanIndicates whether refreshing chart cache data
warningCallbackIWarningCallbackGets or sets warning callback.
checkExcelRestrictionbooleanWhether check restriction of excel file when user modify cells related objects. For example, excel does not allow inputting string value longer than 32K. When you input a value longer than 32K, it will be truncated.
updateSmartArtbooleanIndicates whether updating smart art setting. The default value is false.
encryptDocumentPropertiesbooleanIndicates whether encrypt document properties when saving as .xls file. The default value is true.
defaultFontstringWhen characters in the Excel are Unicode and not be set with correct font in cell style, They may appear as block in pdf,image. Set the DefaultFont such as MingLiu or MS Gothic to show these characters. If this property is not set, Aspose.Cells will use system default font to show these unicode characters.
checkWorkbookDefaultFontbooleanWhen characters in the Excel are Unicode and not be set with correct font in cell style, They may appear as block in pdf,image. Set this to true to try to use workbook’s default font to show these characters first.
checkFontCompatibilitybooleanIndicates whether to check font compatibility for every character in text.
isFontSubstitutionCharGranularitybooleanIndicates whether to only substitute the font of character when the cell font is not compatibility for it.
onePagePerSheetbooleanIf OnePagePerSheet is true , all content of one sheet will output to only one page in result. The paper size of pagesetup will be invalid, and the other settings of pagesetup will still take effect.
allColumnsInOnePagePerSheetbooleanIf AllColumnsInOnePagePerSheet is true , all column content of one sheet will output to only one page in result. The width of paper size of pagesetup will be ignored, and the other settings of pagesetup will still take effect.
ignoreErrorbooleanIndicates if you need to hide the error while rendering. The error can be error in shape, image, chart rendering, etc.
outputBlankPageWhenNothingToPrintbooleanIndicates whether to output a blank page when there is nothing to print.
pageIndexnumberGets or sets the 0-based index of the first page to save.
pageCountnumberGets or sets the number of pages to save.
printingPageTypePrintingPageTypeIndicates which pages will not be printed.
gridlineTypeGridlineTypeGets or sets gridline type.
gridlineColorColorGets or sets gridline color.
textCrossTypeTextCrossTypeGets or sets displaying text type when the text width is larger than cell width.
defaultEditLanguageDefaultEditLanguageGets or sets default edit language.
sheetSetSheetSetGets or sets the sheets to render. Default is all visible sheets in the workbook: Aspose.Cells.Rendering.SheetSet.Visible.
drawObjectEventHandlerDrawObjectEventHandlerImplements this interface to get DrawObject and Bound when rendering.
pageSavingCallbackIPageSavingCallbackControl/Indicate progress of page saving process.
emfRenderSettingEmfRenderSettingSetting for rendering Emf metafile.
customRenderSettingsCustomRenderSettingsGets or sets custom settings during rendering.

Methods

MethodDescription
setImageResample(number, number)Sets desired PPI(pixels per inch) of resample images and jpeg quality. All images will be converted to JPEG with the specified quality setting, and images that are greater than the specified PPI (pixels per inch) will be resampled.

constructor()

Creates the options for saving pdf file.

constructor();

constructor(PaginatedSaveOptions)

Constructs from a parent object convertible to this.

constructor(obj: PaginatedSaveOptions);

Parameters:

ParameterTypeDescription
objPaginatedSaveOptionsThe parent object.

embedStandardWindowsFonts

True to embed true type fonts. Affects only ASCII characters 32-127. Fonts for character codes greater than 127 are always embedded. Fonts are always embedded for PDF/A-1a, PDF/A-1b standard. Default is true.

embedStandardWindowsFonts : boolean;

bookmark

Gets and sets the PdfBookmarkEntry object.

bookmark : PdfBookmarkEntry;

compliance

Gets or sets the PDF standards compliance level for output documents.

compliance : PdfCompliance;

Remarks

Default is Pdf17.

securityOptions

Set this options, when security is need in xls2pdf result.

securityOptions : PdfSecurityOptions;

calculateFormula

Indicates whether to calculate formulas before saving pdf file.

calculateFormula : boolean;

Remarks

The default value is false.

pdfCompression

Indicate the compression algorithm

pdfCompression : PdfCompressionCore;

createdTime

Gets and sets the time of generating the pdf document.

createdTime : Date;

Remarks

if it is not be set, it will be the time of generating the pdf.

producer

Gets and sets producer of generated pdf document.

producer : string;

Remarks

If the value is null, or a valid LICENSE is not set, string Aspose.Cells vVERSION will be used.

optimizationType

Gets and sets pdf optimization type.

optimizationType : PdfOptimizationType;

Remarks

Default value is PdfOptimizationType.Standard

customPropertiesExport

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

customPropertiesExport : PdfCustomPropertiesExport;

exportDocumentStructure

Indicates whether to export document structure.

exportDocumentStructure : boolean;

displayDocTitle

Indicates whether the window’s title bar should display the document title.

displayDocTitle : boolean;

Remarks

If false, the title bar should instead display the name of the PDF file. Default value is false.

fontEncoding

Gets or sets embedded font encoding in pdf.

fontEncoding : PdfFontEncoding;

Remarks

Default value is PdfFontEncoding.Identity

watermark

Gets or sets watermark to output.

watermark : RenderingWatermark;

embedAttachments

Indicates whether to embed attachment for Ole objects in Excel.

embedAttachments : boolean;

Remarks

Default value is false. The value must be false when PDF/A compliance is set or pdf encryption is enabled.

saveFormat

Readonly. Gets the save file format.

saveFormat : SaveFormat;

clearData

Make the workbook empty after saving the file.

clearData : boolean;

cachedFileFolder

The folder for temporary files that may be used as data cache.

cachedFileFolder : string;

Remarks

If the folder has not been specified, the default value for it is CellsHelper.GetCacheFolder(). If its default value is null or empty, or has been specified as null or empty, then no cache file will be used when saving the workbook.

validateMergedAreas

Indicates whether validate merged cells before saving the file.

validateMergedAreas : boolean;

Remarks

The default value is false.

mergeAreas

Indicates whether merge the areas of conditional formatting and validation before saving the file.

mergeAreas : boolean;

Remarks

The default value is false.

createDirectory

If true and the directory does not exist, the directory will be automatically created before saving the file.

createDirectory : boolean;

Remarks

The default value is false.

sortNames

Indicates whether sorting defined names before saving file.

sortNames : boolean;

sortExternalNames

Indicates whether sorting external defined names before saving file.

sortExternalNames : boolean;

refreshChartCache

Indicates whether refreshing chart cache data

refreshChartCache : boolean;

warningCallback

Gets or sets warning callback.

warningCallback : IWarningCallback;

checkExcelRestriction

Whether check restriction of excel file when user modify cells related objects. For example, excel does not allow inputting string value longer than 32K. When you input a value longer than 32K, it will be truncated.

checkExcelRestriction : boolean;

updateSmartArt

Indicates whether updating smart art setting. The default value is false.

updateSmartArt : boolean;

Remarks

Only effects after calling Shape.GetResultOfSmartArt() method and the cached shapes exist in the template file.

encryptDocumentProperties

Indicates whether encrypt document properties when saving as .xls file. The default value is true.

encryptDocumentProperties : boolean;

Remarks

Only for .xls,xlsx,xlsb and xlsm file.

defaultFont

When characters in the Excel are Unicode and not be set with correct font in cell style, They may appear as block in pdf,image. Set the DefaultFont such as MingLiu or MS Gothic to show these characters. If this property is not set, Aspose.Cells will use system default font to show these unicode characters.

defaultFont : string;

checkWorkbookDefaultFont

When characters in the Excel are Unicode and not be set with correct font in cell style, They may appear as block in pdf,image. Set this to true to try to use workbook’s default font to show these characters first.

checkWorkbookDefaultFont : boolean;

Remarks

Default is true.

checkFontCompatibility

Indicates whether to check font compatibility for every character in text.

checkFontCompatibility : boolean;

Remarks

The default value is true. Disable this property may give better performance. But when the default or specified font of text/character cannot be used to render it, unreadable characters(such as block) maybe occur in the generated pdf. For such situation user should keep this property as true so that alternative font can be searched and used to render the text instead;

isFontSubstitutionCharGranularity

Indicates whether to only substitute the font of character when the cell font is not compatibility for it.

isFontSubstitutionCharGranularity : boolean;

Remarks

Default is false. We will try default font of Workbook and PdfSaveOption/system for cell font first.

onePagePerSheet

If OnePagePerSheet is true , all content of one sheet will output to only one page in result. The paper size of pagesetup will be invalid, and the other settings of pagesetup will still take effect.

onePagePerSheet : boolean;

allColumnsInOnePagePerSheet

If AllColumnsInOnePagePerSheet is true , all column content of one sheet will output to only one page in result. The width of paper size of pagesetup will be ignored, and the other settings of pagesetup will still take effect.

allColumnsInOnePagePerSheet : boolean;

ignoreError

Indicates if you need to hide the error while rendering. The error can be error in shape, image, chart rendering, etc.

ignoreError : boolean;

outputBlankPageWhenNothingToPrint

Indicates whether to output a blank page when there is nothing to print.

outputBlankPageWhenNothingToPrint : boolean;

Remarks

Default is true.

pageIndex

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

pageIndex : number;

Remarks

Default is 0.

pageCount

Gets or sets the number of pages to save.

pageCount : number;

Remarks

Default is System.Int32.MaxValue which means all pages will be rendered..

printingPageType

Indicates which pages will not be printed.

printingPageType : PrintingPageType;

Remarks

If content in the sheet is sparse, there will be some pages are totally blank in the output pdf file. If you don’t want these blank pages, you can use this option to omit them.

gridlineType

Gets or sets gridline type.

gridlineType : GridlineType;

Remarks

Default is Dotted type.

gridlineColor

Gets or sets gridline color.

gridlineColor : Color;

Remarks

It will ignore the gridline color settings in the source file.

textCrossType

Gets or sets displaying text type when the text width is larger than cell width.

textCrossType : TextCrossType;

defaultEditLanguage

Gets or sets default edit language.

defaultEditLanguage : DefaultEditLanguage;

Remarks

It may display/render different layouts for text paragraph when different edit languages is set. Default is Aspose.Cells.DefaultEditLanguage.Auto.

sheetSet

Gets or sets the sheets to render. Default is all visible sheets in the workbook: Aspose.Cells.Rendering.SheetSet.Visible.

sheetSet : SheetSet;

drawObjectEventHandler

Implements this interface to get DrawObject and Bound when rendering.

drawObjectEventHandler : DrawObjectEventHandler;

pageSavingCallback

Control/Indicate progress of page saving process.

pageSavingCallback : IPageSavingCallback;

emfRenderSetting

Setting for rendering Emf metafile.

emfRenderSetting : EmfRenderSetting;

Remarks

EMF metafiles identified as “EMF+ Dual” can contain both EMF+ records and EMF records. Either type of record can be used to render the image, only EMF+ records, or only EMF records. When Aspose.Cells.EmfRenderSetting.EmfPlusPrefer is set, then EMF+ records will be parsed while rendering to page, otherwise only EMF records will be parsed. Default value is Aspose.Cells.EmfRenderSetting.EmfOnly.

customRenderSettings

Gets or sets custom settings during rendering.

customRenderSettings : CustomRenderSettings;

setImageResample(number, number)

Sets desired PPI(pixels per inch) of resample images and jpeg quality. All images will be converted to JPEG with the specified quality setting, and images that are greater than the specified PPI (pixels per inch) will be resampled.

setImageResample(desiredPPI: number, jpegQuality: number) : void;

Parameters:

ParameterTypeDescription
desiredPPInumberDesired pixels per inch. 220 high quality. 150 screen quality. 96 email quality.
jpegQualitynumber0 - 100% JPEG quality.