Class HtmlFormatOptions
This class contains properties that define the formatting options for converting PDF to HTML.
Inheritance
Namespace: IronPdf
Assembly: IronPdf.dll
Syntax
public class HtmlFormatOptions : Object
Working with PDF generation in IronPDF runs through HtmlFormatOptions. It contains properties that define the formatting options for converting PDF to HTML.
HtmlFormatOptions matters when an application needs to configure or invoke PDF generation from C# code. The class encapsulates the related options and behavior in a single object that is set up once and reused across render or processing calls. Typical scenarios include batch generation pipelines, templated document workflows, and integration with existing C# document services.
To use HtmlFormatOptions, instantiate or obtain it from the relevant entry point in the IronPDF C# API. Key properties include BackgroundColor, H1Color, H1FontSize, H1TextAlignment. Assign options or invoke methods on the instance to configure or perform the operation.
using IronPdf;
var instance = new HtmlFormatOptions();
var current = instance.BackgroundColor;
// Read or assign other properties such as H1Color, H1FontSizeFor the broader workflow, see the IronPDF C# documentation for related how-to guides and examples. For broader context, the PDF generation portion of the IronPDF C# API contains related types that work with HtmlFormatOptions directly. HtmlFormatOptions exposes additional members beyond those highlighted above; the reference tables on this page list the full set. In application code, treat HtmlFormatOptions as a configured object that is constructed once and reused across operations rather than instantiated per call. Configuration is generally idempotent: assigning the same property value twice has the same effect as assigning it once. For diagnostic purposes, inspect the relevant HtmlFormatOptions property after each operation to confirm the configured state. See the constructors, properties, and methods tables below for the complete API surface of HtmlFormatOptions. Application code typically obtains or instantiates a single HtmlFormatOptions and shares it across multiple IronPDF operations rather than recreating it per call.
Constructors
HtmlFormatOptions()
Declaration
public HtmlFormatOptions()
Properties
BackgroundColor
The background color of the HTML body. Default is white.
Declaration
public Color BackgroundColor { get; set; }
Property Value
| Type | Description |
|---|---|
| IronSoftware.Drawing.Color |
H1Color
The color of the title (h1) in the HTML document. Default is black.
Declaration
public Color H1Color { get; set; }
Property Value
| Type | Description |
|---|---|
| IronSoftware.Drawing.Color |
H1FontSize
The font size of the title (h1) in the HTML document, specified in pixels. Default is 20.
Declaration
public int H1FontSize { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
H1TextAlignment
The text alignment of the title (h1) in the HTML document. Default is TextAlignment.Center.
Declaration
public TextAlignment H1TextAlignment { get; set; }
Property Value
| Type | Description |
|---|---|
| TextAlignment |
PdfPageMargin
The margin around each PDF page in the HTML document, specified in pixels. Default is 10.
Declaration
public int PdfPageMargin { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |