GemBox.Spreadsheet
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    PdfSaveOptions Class

    Namespace:
    GemBox.Spreadsheet
    Assembly:
    GemBox.Spreadsheet.dll

    Represents options for saving to Portable Document Format (PDF) file.

    • C#
    • VB.NET
    public sealed class PdfSaveOptions : SaveOptions
    Public NotInheritable Class PdfSaveOptions
        Inherits SaveOptions
    Inheritance:
    Object
    SaveOptions
    PdfSaveOptions

    Constructors

    PdfSaveOptions()

    Initializes a new instance of the PdfSaveOptions class.

    • C#
    • VB.NET
    public PdfSaveOptions()
    Public Sub New

    Properties

    ConformanceLevel

    Gets or sets the level of conformance for PDF document.

    • C#
    • VB.NET
    public PdfConformanceLevel ConformanceLevel { get; set; }
    Public Property ConformanceLevel As PdfConformanceLevel
    Property Value
    PdfConformanceLevel

    The level of conformance for PDF document.

    ContentType

    Gets the content-type for PDF file format: application/pdf.

    • C#
    • VB.NET
    public override string ContentType { get; }
    Public Overrides ReadOnly Property ContentType As String
    Property Value
    String

    The content-type for PDF file format.

    Overrides
    SaveOptions.ContentType

    DigitalSignature

    Gets or sets the digital signature options.

    • C#
    • VB.NET
    public PdfDigitalSignatureSaveOptions DigitalSignature { get; set; }
    Public Property DigitalSignature As PdfDigitalSignatureSaveOptions
    Property Value
    PdfDigitalSignatureSaveOptions

    The digital signature options.

    DocumentOpenPassword

    Specifies the password required for opening the encrypted PDF document.

    • C#
    • VB.NET
    public string DocumentOpenPassword { get; set; }
    Public Property DocumentOpenPassword As String
    Property Value
    String
    Remarks

    Generated PDF document will be encrypted if any of the following conditions are satisfied:

    • Permissions is different than All.
    • PermissionsPassword is not null or Empty.
    • DocumentOpenPassword is not null or Empty.

    Both PermissionsPassword and DocumentOpenPassword are optional but with the following consequences:

    • If Permissions is different than All and PermissionsPassword is not specified, component will generate random PermissionsPassword.
    • Using PermissionsPassword, also known as owner password, without DocumentOpenPassword is not secure. It relies on PDF viewer software to respect specified restrictions, but it may choose not to do so.
    • Using DocumentOpenPassword, also known as user password, is potentially very secure. It or PermissionsPassword is required for decrypting and viewing the document.
    • When DocumentOpenPassword is specified, PDF viewer application will prompt for password to decrypt and present the document. If entered password is DocumentOpenPassword, document will be decrypted and presented with specified Permissions enforced. Otherwise, if entered password is PermissionsPassword, document will be decrypted and presented without any restrictions.

    DocumentOpenPassword and PermissionsPassword cannot be equal, otherwise exception is thrown.

    ImageDpi

    Gets or sets the saved images DPI.

    • C#
    • VB.NET
    public int ImageDpi { get; set; }
    Public Property ImageDpi As Integer
    Property Value
    Int32

    The saved images DPI.

    Remarks

    This property controls the image quality for all images in the file. Larger value results in better-quality images but increases the file size. Setting this property to 0 will disable image optimization. Standard DPI values are:

    • 330 - Good quality for HD displays
    • 220 - Good quality for most printers and displays
    • 150 - Good quality for web pages and projectors
    • 96 - Good quality for smaller file sizes

    Limitations

    Gets limitations for saving to PDF file format.

    • C#
    • VB.NET
    public override FileFormatLimitations Limitations { get; }
    Public Overrides ReadOnly Property Limitations As FileFormatLimitations
    Property Value
    FileFormatLimitations
    Overrides
    SaveOptions.Limitations
    Remarks

    These are the limits:

    • MaxRows: MaxValue
    • MaxColumns: MaxValue
    • MaxColors: MaxValue
    • MaxCellStyles: MaxValue

    MetafileScaleFactor

    Gets or sets the scaling factor for rendering metafile (WMF and EMF) images. Greater scaling factor improves quality but also increases file size. Default value is 1.

    • C#
    • VB.NET
    public double MetafileScaleFactor { get; set; }
    Public Property MetafileScaleFactor As Double
    Property Value
    Double

    The metafile scale factor for rendering metafile (WMF and EMF) images.

    Remarks

    Windows Metafile Format (WMF) and Enhanced Metafile Format (EMF) are vector image formats which contain a series of graphics drawing commands usually executed in Windows GDI layer.

    Metafile drawing commands could also be executed in PDF (or XPS) file which is also vector format, but for that Metafile drawing commands would have to be converted to PDF drawing commands.

    GemBox.Document currently doesn't perform this conversion of drawing commands, instead it uses Windows GDI to execute Metafile drawing commands into bitmap which is then encoded to PNG format and embedded into PDF file.

    MetafileScaleFactor specifies the size of the bitmap surface, based from the original Metafile surface size, into which Metafile should be drawn / rasterized.

    PDF viewer will still scale the bitmap to the original Metafile size, but if the page is zoomed or viewed on a larger surface, quality of the image will be better since it contains more pixels / dots which will become visible while PDF viewer scales down the image.

    MetafileScaleFactor increases the quality of the Metafile image in PDF file, but it also increases the size of the PDF file because greater MetafileScaleFactor means greater bitmap surface and more space to store bitmap pixel / color data. PNG encoding / compression helps in reducing the space requirement and for complex Metafiles (with a lot of drawing instructions), MetafileScaleFactor of 5 or even greater, might not incur any space overhead relative to the original (complex) Metafile.

    Default value for MetafileScaleFactor is 1.

    Permissions

    Gets or sets the operations that are allowed to a user on an encrypted PDF document.

    • C#
    • VB.NET
    public PdfPermissions Permissions { get; set; }
    Public Property Permissions As PdfPermissions
    Property Value
    PdfPermissions
    Remarks

    Generated PDF document will be encrypted if any of the following conditions are satisfied:

    • Permissions is different than All.
    • PermissionsPassword is not null or Empty.
    • DocumentOpenPassword is not null or Empty.

    Both PermissionsPassword and DocumentOpenPassword are optional but with the following consequences:

    • If Permissions is different than All and PermissionsPassword is not specified, component will generate random PermissionsPassword.
    • Using PermissionsPassword, also known as owner password, without DocumentOpenPassword is not secure. It relies on PDF viewer software to respect specified restrictions, but it may choose not to do so.
    • Using DocumentOpenPassword, also known as user password, is potentially very secure. It or PermissionsPassword is required for decrypting and viewing the document.
    • When DocumentOpenPassword is specified, PDF viewer application will prompt for password to decrypt and present the document. If entered password is DocumentOpenPassword, document will be decrypted and presented with specified Permissions enforced. Otherwise, if entered password is PermissionsPassword, document will be decrypted and presented without any restrictions.

    DocumentOpenPassword and PermissionsPassword cannot be equal, otherwise exception is thrown.

    PermissionsPassword

    Specifies the password for opening the encrypted PDF document without any access restrictions.

    • C#
    • VB.NET
    public string PermissionsPassword { get; set; }
    Public Property PermissionsPassword As String
    Property Value
    String
    Remarks

    Generated PDF document will be encrypted if any of the following conditions are satisfied:

    • Permissions is different than All.
    • PermissionsPassword is not null or Empty.
    • DocumentOpenPassword is not null or Empty.

    Both PermissionsPassword and DocumentOpenPassword are optional but with the following consequences:

    • If Permissions is different than All and PermissionsPassword is not specified, component will generate random PermissionsPassword.
    • Using PermissionsPassword, also known as owner password, without DocumentOpenPassword is not secure. It relies on PDF viewer software to respect specified restrictions, but it may choose not to do so.
    • Using DocumentOpenPassword, also known as user password, is potentially very secure. It or PermissionsPassword is required for decrypting and viewing the document.
    • When DocumentOpenPassword is specified, PDF viewer application will prompt for password to decrypt and present the document. If entered password is DocumentOpenPassword, document will be decrypted and presented with specified Permissions enforced. Otherwise, if entered password is PermissionsPassword, document will be decrypted and presented without any restrictions.

    DocumentOpenPassword and PermissionsPassword cannot be equal, otherwise exception is thrown.

    RasterizeVectorPictures

    Gets or sets a value indicating whether to rasterize vector pictures.

    • C#
    • VB.NET
    public bool RasterizeVectorPictures { get; set; }
    Public Property RasterizeVectorPictures As Boolean
    Property Value
    Boolean

    The value indicating whether to rasterize vector pictures.

    SelectionType

    Gets or sets a value indicating whether to save the whole ExcelFile or just ActiveWorksheet.

    • C#
    • VB.NET
    public SelectionType SelectionType { get; set; }
    Public Property SelectionType As SelectionType
    Property Value
    SelectionType

    Events

    ProgressChanged

    Occurs when saving progress of a file has changed.

    • C#
    • VB.NET
    public event EventHandler<OperationProgressChangedEventArgs> ProgressChanged
    Public Event ProgressChanged As EventHandler(Of OperationProgressChangedEventArgs)
    Event Type
    EventHandler<OperationProgressChangedEventArgs>

    Inherited Properties

    CsvDefault

    Gets the default options for saving to Character Separated Values file format.

    (Inherited from SaveOptions)

    HtmlDefault

    Gets the default options for saving to HyperText Markup Language File format.

    (Inherited from SaveOptions)

    ImageDefault

    Gets the default options for saving to image formats.

    (Inherited from SaveOptions)

    OdsDefault

    Gets the default options for saving to OpenDocument Spreadsheet file format.

    (Inherited from SaveOptions)

    PdfDefault

    Gets the default options for saving to Portable Document Format file.

    (Inherited from SaveOptions)

    TxtDefault

    Gets the default options for saving to Tab delimited file format.

    (Inherited from SaveOptions)

    XlsDefault

    Gets the default options for saving to, XLS file format (Microsoft Excel Spreadsheet format; Excel 2003 and prior versions) .

    (Inherited from SaveOptions)

    XlsbDefault

    Gets the default options for saving to XLSB file format (Microsoft Excel Binary File Format).

    (Inherited from SaveOptions)

    XlsxDefault

    Gets the default options for saving to XLSX file format (Microsoft Excel Open XML Spreadsheet; Excel 2007 and later).

    (Inherited from SaveOptions)

    XpsDefault

    Gets the default options for saving to XML Paper Specification file format.

    (Inherited from SaveOptions)

    Examples

    Convert Excel files to PDF in C# and VB.NET
    PDF digital signature examples
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.