# HtmlConverterOptions class

> Settings for HtmlConverter. HtmlConverterOptions class, PdfNetStack.Html namespace.

Namespace: [PdfNetStack.Html](https://www.jadev-corp.com/api/pdfnetstack-html/)  
Assembly: PdfNetStack.Html.dll  
Package: `PdfNetStack.Html`

Settings for [HtmlConverter](https://www.jadev-corp.com/api/pdfnetstack-html/htmlconverter/).

```csharp
public sealed class HtmlConverterOptions
```

**Inheritance**

[object](https://learn.microsoft.com/dotnet/api/system.object) ← 
[HtmlConverterOptions](https://www.jadev-corp.com/api/pdfnetstack-html/htmlconverteroptions/)

## Properties

### <a id="PdfNetStack_Html_HtmlConverterOptions_BaseUri"></a> BaseUri

The address relative URLs resolve against: a file path's URI such as
<code>new Uri(@"C:\reports\")</code>, or a web address when [ResourceLoader](https://www.jadev-corp.com/api/pdfnetstack-html/htmlconverteroptions/#PdfNetStack_Html_HtmlConverterOptions_ResourceLoader) fetches
from the network. Null when the HTML only uses absolute URLs or data: URIs.

```csharp
public Uri? BaseUri { get; init; }
```

#### Property Value

 [Uri](https://learn.microsoft.com/dotnet/api/system.uri)?

### <a id="PdfNetStack_Html_HtmlConverterOptions_Bookmarks"></a> Bookmarks

Headings become bookmarks (the bookmark-level property). Default true.

```csharp
public bool Bookmarks { get; init; }
```

#### Property Value

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="PdfNetStack_Html_HtmlConverterOptions_Fonts"></a> Fonts

Fonts to use before installed ones, matched by family name, width, style and weight.

```csharp
public PdfFontCollection? Fonts { get; init; }
```

#### Property Value

 [PdfFontCollection](https://www.jadev-corp.com/api/pdfnetstack-fonts/pdffontcollection/)?

### <a id="PdfNetStack_Html_HtmlConverterOptions_Hyphenators"></a> Hyphenators

Finds the hyphenator for a language tag, or null when there is none, for text with
<code>hyphens: auto</code>; its language is the nearest <code>lang</code> attribute, and text without
one is not hyphenated, as CSS Text 3 says. Called once per tag in a conversion.
<code>PdfHyphenationPatterns.ForLanguage</code> from the <code>PdfNetStack.Hyphenation</code> package
fits here. Null, the default, treats <code>hyphens: auto</code> like <code>manual</code>: words break
only at soft hyphens.

```csharp
public Func<string, PdfHyphenator?>? Hyphenators { get; init; }
```

#### Property Value

 [Func](https://learn.microsoft.com/dotnet/api/system.func\-2)<[string](https://learn.microsoft.com/dotnet/api/system.string), [PdfHyphenator](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdfhyphenator/)?\>?

### <a id="PdfNetStack_Html_HtmlConverterOptions_MaxPages"></a> MaxPages

The most pages a conversion may produce. Default 10000. A document that needs more, such as
one whose sizes run to kilometres, ends with [HtmlConversionException](https://www.jadev-corp.com/api/pdfnetstack-html/htmlconversionexception/) instead of
using memory without bound.

```csharp
public int MaxPages { get; init; }
```

#### Property Value

 [int](https://learn.microsoft.com/dotnet/api/system.int32)

#### Exceptions

 [ArgumentOutOfRangeException](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception)

The value is less than 1.

### <a id="PdfNetStack_Html_HtmlConverterOptions_PageStyle"></a> PageStyle

The page size and margins before the document's @page rules, as CSS. Default
<code>size: A4; margin: 2cm</code>.

```csharp
public string PageStyle { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

### <a id="PdfNetStack_Html_HtmlConverterOptions_ResourceLoader"></a> ResourceLoader

Fetches style sheets, images and fonts by absolute URL; return null for anything that
should not load. Without a loader only data: URIs and files under [BaseUri](https://www.jadev-corp.com/api/pdfnetstack-html/htmlconverteroptions/#PdfNetStack_Html_HtmlConverterOptions_BaseUri)
load, and nothing comes from the network: keep it that way for untrusted HTML, or check
each address before fetching it.

```csharp
public Func<Uri, byte[]?>? ResourceLoader { get; init; }
```

#### Property Value

 [Func](https://learn.microsoft.com/dotnet/api/system.func\-2)<[Uri](https://learn.microsoft.com/dotnet/api/system.uri), [byte](https://learn.microsoft.com/dotnet/api/system.byte)\[\]?\>?

### <a id="PdfNetStack_Html_HtmlConverterOptions_SaveOptions"></a> SaveOptions

How [ConvertToPdf](https://www.jadev-corp.com/api/pdfnetstack-html/htmlconverter/#PdfNetStack_Html_HtmlConverter_ConvertToPdf_System_String_PdfNetStack_Html_HtmlConverterOptions_) saves the
document, such as a PDF/A conformance level. Null, the default, saves as
[Default](https://www.jadev-corp.com/api/pdfnetstack/pdfsaveoptions/#PdfNetStack_PdfSaveOptions_Default) does but without the optimizer's equivalence proof
([VerifyOptimization](https://www.jadev-corp.com/api/pdfnetstack/pdfsaveoptions/#PdfNetStack_PdfSaveOptions_VerifyOptimization) false): the converter draws all the
content itself, and the bytes are the same whenever the proof would pass. Set
[Default](https://www.jadev-corp.com/api/pdfnetstack/pdfsaveoptions/#PdfNetStack_PdfSaveOptions_Default) to keep the proof.

```csharp
public PdfSaveOptions? SaveOptions { get; init; }
```

#### Property Value

 [PdfSaveOptions](https://www.jadev-corp.com/api/pdfnetstack/pdfsaveoptions/)?

### <a id="PdfNetStack_Html_HtmlConverterOptions_StyleSheet"></a> StyleSheet

A style sheet applied before the document's own, for house styles.

```csharp
public string? StyleSheet { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="PdfNetStack_Html_HtmlConverterOptions_Tagged"></a> Tagged

Writes a tagged PDF (ISO 32000-1, 14.8): headings, paragraphs, lists, tables, figures with
their alt text and links in a structure tree, in reading order, with backgrounds, borders,
repeated headers and page margins marked as artifacts, so screen readers and reflow work.
Default true.

```csharp
public bool Tagged { get; init; }
```

#### Property Value

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="PdfNetStack_Html_HtmlConverterOptions_UseSystemFonts"></a> UseSystemFonts

Whether installed fonts are used, for families the HTML names and as fallbacks for
characters such as Arabic. Default true. With false, output depends only on the HTML, the
supplied fonts and the standard 14 fonts, and is the same on every machine.

```csharp
public bool UseSystemFonts { get; init; }
```

#### Property Value

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

## Used in

- [Run PdfNetStack on AWS Lambda](https://www.jadev-corp.com/guides/aws-lambda/)
- [Run PdfNetStack on Azure Functions](https://www.jadev-corp.com/guides/azure-functions/)
- [Fonts and text in PDF with C# and .NET](https://www.jadev-corp.com/guides/fonts-and-text/)
- [HTML to PDF in C# without a browser](https://www.jadev-corp.com/guides/html-to-pdf/)
- [CSS support in PdfNetStack.Html](https://www.jadev-corp.com/guides/html-to-pdf/css-support/)
- [Fonts, images and resources in HTML to PDF](https://www.jadev-corp.com/guides/html-to-pdf/fonts-and-assets/)
- [Page headers, footers and numbers in HTML](https://www.jadev-corp.com/guides/html-to-pdf/paged-media/)
- [Convert an HTML invoice to PDF in C#](https://www.jadev-corp.com/recipes/html-invoice-to-pdf/)

Source: https://www.jadev-corp.com/pdfnetstack/api/pdfnetstack-html/htmlconverteroptions/
