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

    Show / Hide Table of Contents

    PdfSaveOptions Class

    Namespace:
    GemBox.Document
    Assembly:
    GemBox.Document.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:
    System.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 Permissions remarks.

    Constructors

    PdfSaveOptions()

    Initializes a new instance of the PdfSaveOptions class.

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

    Properties

    BookmarksCreateOptions

    Gets or sets a value indicating whether to create PDF bookmarks (outlines).

    Default value: UsingHeadings (for backward compatibility).

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

    A value indicating whether to create PDF bookmarks (outlines).

    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
    System.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
    System.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 System.String.Empty.
    • DocumentOpenPassword is not null or System.String.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
    System.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

    Using this property you basically specify the DPI of the display device on which the file will be viewed and for which the images in the file should be optimized without losing any perceived quality because images go through the same resampling (reduction of pixel count) as they would in the viewer application if viewing the file using the default (100%) zoom factor on that display device.

    For example, if an image whose pixel size is 600px × 400px is shown on page where it occupies a slot whose physical size is 150pt × 100pt, then if the display device DPI is 144px/inch, the viewer application will show the image in a display slot whose pixel size is 300px × 200px if the default (100%) zoom factor is used (Rationale: there are always 72 points per inch and for the DPI of 144, there are 144 pixels per inch, so 150[pt] = 150[pt] × 144[px/inch] / 72[pt/inch] = 300[px]).
    So the viewer application has to fit an image into a smaller display slot and it will do so by resampling the image from 600px × 400px to 300px × 200px.
    Reducing the total number of pixels 4 times (from 240000 to 60000) would also reduce the image file size, so GemBox component can do this instead of the viewer application, thus achieving the overall smaller file size without any perceived loss of quality since the same image resampling would have been done by the viewer application anyway if the default (100%) zoom factor is used.
    Instructing the GemBox component to perform image resampling (by setting the ImageDpi property to the DPI of the display device on which the file is going to be viewed) has two effects:

    • Major benefit: output file size will be smaller if there are images whose pixel size is greater than their display size because those images are resampled to a smaller number of pixels without any perceived loss of quality since the same resampling would have been done by the viewer application anyway.
    • Minor benefit: viewer application will be able to present the image faster because it needs to decode a fewer number of pixels and because the display slot size will be exactly equal to the image pixel size so it doesn't have to perform any resampling if the default (100%) zoom factor is used.

    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 System.String.Empty.
    • DocumentOpenPassword is not null or System.String.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
    System.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 System.String.Empty.
    • DocumentOpenPassword is not null or System.String.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.

    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
    System.Boolean

    The value indicating whether to rasterize vector pictures.

    Version

    Gets or sets the version of the PDF specification to which the PDF document conforms specified in the PDF file's header (see 7.5.2, "File Header").

    Note that the PDF file's header version might be coerced to a value higher than the one specified in Version if the PDF file uses features that are not supported by the version specified in Version.

    If the value is null then PDF file's header version will be automatically set to a specific value depending on the features used in the PDF file.

    Default value: null.

    • C#
    • VB.NET
    public PdfVersion? Version { get; set; }
    Public Property Version As PdfVersion?
    Property Value
    System.Nullable<PdfVersion>

    The version of the PDF specification to which the PDF document conforms specified in the PDF file's header.

    Events

    ProgressChanged

    Occurs when saving progress of a document has changed.

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

    Inherited Properties

    DocxDefault

    Gets the default saving options for Microsoft Word file format. Word file will be saved in Docx format.

    (Inherited from SaveOptions)

    HtmlDefault

    Gets the default saving options for HyperText Markup Language (HTML) format.

    (Inherited from SaveOptions)

    ImageDefault

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

    (Inherited from SaveOptions)

    OdtDefault

    Gets the default saving options for Open Document file format.

    (Inherited from SaveOptions)

    PageCount

    Gets or sets the number of pages which should be saved.

    (Inherited from SaveOptions)

    PageNumber

    Gets or sets the zero-based page number of the document's first page which should be saved.

    (Inherited from SaveOptions)

    PdfDefault

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

    (Inherited from SaveOptions)

    RtfDefault

    Gets the default saving options for Rich Text (RTF) format.

    (Inherited from SaveOptions)

    TxtDefault

    Gets the default saving options for Plain Text (TXT) format.

    (Inherited from SaveOptions)

    XmlDefault

    Gets the default saving options for XML file format.

    (Inherited from SaveOptions)

    XpsDefault

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

    (Inherited from SaveOptions)

    Examples

    Convert Word and HTML to PDF in C# and VB.NET
    PDF digital signature examples
    PDF Encryption example

    See Also

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

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.