ConversionOptions Class
Represents options used for HTML to PDF conversion.
- Inheritance:
- System.ObjectConversionOptions
Properties
BaseAddress
Gets or sets the base address for URLs with relative location.
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.
public string ChromeDirectoryPath { get; set; }Public Property ChromeDirectoryPath As StringProperty 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.
Property Value
Remarks
The default value is Screen.
DisableChromeSandbox
Gets or sets a value indicating whether Chrome's sandbox is disabled during conversion.
public bool DisableChromeSandbox { get; set; }Public Property DisableChromeSandbox As BooleanProperty 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.
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.
Property Value
Remarks
The default value is 36pt for all edges.
PageOrientation
Gets or sets the orientation of a PDF document.
public PrintPageOrientation PageOrientation { get; set; }Public Property PageOrientation As PrintPageOrientationProperty Value
Remarks
The default value is Portrait.
PageSize
Gets or sets the output paper size.
Property Value
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.
public event EventHandler<ResourceLoadingEventArgs> ResourceLoadingPublic Event ResourceLoading As EventHandler(Of ResourceLoadingEventArgs)Event Type
- System.EventHandler<ResourceLoadingEventArgs>