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

    Show / Hide Table of Contents

    PdfSaveOptions Class

    Namespace:
    GemBox.Presentation
    Assembly:
    GemBox.Presentation.dll

    Represents a class that stores saving options for Portable Document Format (PDF) file.

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

    For more information about a level of support for PDF format, see supported file formats.

    For more information about PDF encryption, see Permissionsremarks.

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

    The password required for opening the encrypted PDF document.

    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.

    For more information, see PDF Encryption example.

    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

    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.Presentation 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

    The operations that are allowed to a user on an encrypted PDF document.

    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.

    For more information, see PDF Encryption example.

    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

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

    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.

    For more information, see PDF Encryption example.

    Inherited Properties

    Image

    Gets the default saving options for image file format. Image will be saved in Bmp format.

    (Inherited from SaveOptions)

    Pdf

    Gets the default saving options for Portable Document Format (PDF).

    (Inherited from SaveOptions)

    Pptx

    Gets the default saving options for PowerPoint Presentation (PPTX) format.

    (Inherited from SaveOptions)

    Xps

    Gets the default saving options for XML Paper Specification (XPS) format.

    (Inherited from SaveOptions)

    Examples

    Convert PowerPoint files to PDF in C# and VB.NET
    PDF digital signature examples
    PDF Encryption example

    See Also

    Pdf
    Save(String, SaveOptions)
    Save(Stream, SaveOptions)
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.