HtmlConverterOptions class
Namespace: PdfNetStack.Html
Assembly: PdfNetStack.Html.dll
Package: PdfNetStack.Html
Settings for HtmlConverter.
public sealed class HtmlConverterOptionsInheritance
Properties
Section titled “Properties”BaseUri
Section titled “ BaseUri”The address relative URLs resolve against: a file path’s URI such as
new Uri(@“C:\reports”), or a web address when ResourceLoader fetches
from the network. Null when the HTML only uses absolute URLs or data: URIs.
public Uri? BaseUri { get; init; }Property Value
Section titled “Property Value”Uri?
Bookmarks
Section titled “ Bookmarks”Headings become bookmarks (the bookmark-level property). Default true.
public bool Bookmarks { get; init; }Property Value
Section titled “Property Value”Fonts to use before installed ones, matched by family name, width, style and weight.
public PdfFontCollection? Fonts { get; init; }Property Value
Section titled “Property Value”Hyphenators
Section titled “ Hyphenators”Finds the hyphenator for a language tag, or null when there is none, for text with
hyphens: auto; its language is the nearest lang attribute, and text without
one is not hyphenated, as CSS Text 3 says. Called once per tag in a conversion.
PdfHyphenationPatterns.ForLanguage from the PdfNetStack.Hyphenation package
fits here. Null, the default, treats hyphens: auto like manual: words break
only at soft hyphens.
public Func<string, PdfHyphenator?>? Hyphenators { get; init; }Property Value
Section titled “Property Value”Func<string, PdfHyphenator?>?
MaxPages
Section titled “ 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 instead of using memory without bound.
public int MaxPages { get; init; }Property Value
Section titled “Property Value”Exceptions
Section titled “Exceptions”The value is less than 1.
PageStyle
Section titled “ PageStyle”The page size and margins before the document’s @page rules, as CSS. Default
size: A4; margin: 2cm.
public string PageStyle { get; init; }Property Value
Section titled “Property Value”ResourceLoader
Section titled “ 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 load, and nothing comes from the network: keep it that way for untrusted HTML, or check each address before fetching it.
public Func<Uri, byte[]?>? ResourceLoader { get; init; }Property Value
Section titled “Property Value”SaveOptions
Section titled “ SaveOptions”How ConvertToPdf saves the document, such as a PDF/A conformance level. Null, the default, saves as Default does but without the optimizer’s equivalence proof (VerifyOptimization false): the converter draws all the content itself, and the bytes are the same whenever the proof would pass. Set Default to keep the proof.
public PdfSaveOptions? SaveOptions { get; init; }Property Value
Section titled “Property Value”StyleSheet
Section titled “ StyleSheet”A style sheet applied before the document’s own, for house styles.
public string? StyleSheet { get; init; }Property Value
Section titled “Property Value”Tagged
Section titled “ 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.
public bool Tagged { get; init; }Property Value
Section titled “Property Value”UseSystemFonts
Section titled “ 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.
public bool UseSystemFonts { get; init; }