GemBox.Pdf
  • Overview
  • Examples
  • Free version
  • Support
  • Pricing

    Show / Hide Table of Contents

    ConversionOptions Class

    Namespace:
    GemBox.Pdf.Html
    Assembly:
    GemBox.Pdf.Html.Core.dll

    Represents options used for HTML to PDF conversion.

    • C#
    • VB.NET
    public class ConversionOptions
    Public Class ConversionOptions
    Inheritance:
    System.Object
    ConversionOptions

    Properties

    BaseAddress

    Gets or sets the base address for URLs with relative location.

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

    The base address for URLs with relative location.

    ChromeDirectoryPath

    Gets or sets the path to the directory which contains the Chrome executable.

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

    The path to the directory which contains the Chrome executable.

    Remarks

    By default, this property is null and the Chrome binaries installed with the GemBox.Pdf.Html.Windows or GemBox.Pdf.Html.Linux package are located automatically.

    CssMediaType

    Gets or sets which media type should be used to resolve styles when converting HTML to PDF.

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

    The default value is Screen.

    DisableChromeSandbox

    Gets or sets a value indicating whether Chrome's sandbox is disabled during conversion.

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

    The default value is false. Set this to true to convert HTML to PDF in environments where Chrome's sandbox cannot be used, such as when running as the root user or on Azure App Service. Running Chrome without a sandbox reduces security, so enable this only when the HTML content being converted is trusted.

    Encoding

    Gets or sets the encoding of the HTML stream.

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

    The encoding of the HTML stream.

    Remarks

    The default value is System.Text.Encoding.UTF8.

    PageMargins

    Gets or sets the margins of a PDF document.

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

    The default value is 36pt for all edges.

    PageOrientation

    Gets or sets the orientation of a PDF document.

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

    The default value is Portrait.

    PageSize

    Gets or sets the output paper size.

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

    The Default value is 595pt x 842pt (A4 size).

    Events

    ResourceLoading

    Occurs when external resources such as images, style sheets, scripts, and fonts are being loaded during HTML to PDF conversion. Use this event to customize or replace individual resource data.

    • C#
    • VB.NET
    public event EventHandler<ResourceLoadingEventArgs> ResourceLoading
    Public Event ResourceLoading As EventHandler(Of ResourceLoadingEventArgs)
    Event Type
    System.EventHandler<ResourceLoadingEventArgs>
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.