# HtmlConversionDocument

Canonical OfficeIMO HTML conversion document shared by target adapters.

Class 

`OfficeIMO.Html`

**Namespace**

`OfficeIMO.Html`

**Assembly**

`OfficeIMO.Html`

**Source revision**

`be6c300e4ab1` with working tree changes

**Source**

[HtmlConversionDocument.cs:105](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.cs#L105)

**Modifiers**

sealed

Canonical OfficeIMO HTML conversion document shared by target adapters.

## Inheritance

- object
- HtmlConversionDocument

## Guides & Samples

Authored walkthroughs and practical samples linked to this API.

- [HTML and MHTML](/docs/html/) Guide
- [Convert HTML to PDF](/docs/html/html-to-pdf/) Guide
  
  Convert HTML pages and reports to PDF in .NET without a browser, with page size, margins, extra CSS, headers and footers, and local images and fonts.
- [Render HTML to Images and Convert to Word, Markdown and RTF](/docs/html/render-and-convert/) Guide
  
  Render HTML to PNG, JPEG, WebP, TIFF or SVG screenshots and page images, and convert HTML into editable Word, Markdown or RTF documents.
- [Convert Word to HTML and HTML to Word](/docs/converters/word-html/) Guide
  
  Convert DOCX to HTML, build Word documents from HTML, and add HTML content to the body, headers, and footers of an existing document with OfficeIMO.Word.Html.
- [Convert Markdown to HTML, PDF and Word](/docs/markdown/convert/) Guide
  
  Convert Markdown to HTML, PDF and Word, and HTML back to Markdown, with conversion reports that list anything that could not be kept.
- [Convert Word to PDF, HTML, and Markdown](/docs/word/conversion/) Guide
  
  Convert DOCX to PDF, HTML, Markdown, ODT and RTF, and create Word documents from HTML or Markdown, with OfficeIMO.Word converters and PSWriteOffice.
- [Personalized course certificate](/showcase/html-course-certificate/) Sample
  
  Render a personalized HTML workshop certificate to PDF with an inline SVG mark and print styling. Includes the HTML document and runnable C# source.
- [Service review with explicit target misses](/showcase/html-service-level-report/) Sample
  
  Generate an HTML service review that compares actual values with targets and keeps missed thresholds visible in the PDF.

## Usage

Explore 17 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Returned or exposed by 9

- Method [HtmlConversionDocument.Edit](/api/html/officeimo-html-htmlconversiondocument/#method-edit-action-officeimo-html-dom-htmldocument)
- Method [HtmlConversionDocument.FromDocument](/api/html/officeimo-html-htmlconversiondocument/#method-fromdocument-officeimo-html-dom-htmldocument-officeimo-html-htmlconversiondocumentoptions)
- Method [HtmlConversionDocument.Load](/api/html/officeimo-html-htmlconversiondocument/#method-load-string-officeimo-html-htmlconversiondocumentoptions-text-encoding)
- Method [HtmlConversionDocument.LoadAsync](/api/html/officeimo-html-htmlconversiondocument/#method-loadasync-string-officeimo-html-htmlconversiondocumentoptions-text-encoding-threading-cancellationtoken)
- Method [HtmlConversionDocument.Parse](/api/html/officeimo-html-htmlconversiondocument/#method-parse-string-officeimo-html-htmlconversiondocumentoptions)
- Method [HtmlConversionDocument.WithTheme](/api/html/officeimo-html-htmlconversiondocument/#method-withtheme-officeimo-officetheme)
- Property [HtmlSiteBundle.HtmlDocument](/api/html/officeimo-html-htmlsitebundle/#property-htmldocument)
- Method [HtmlVisibleContentResult.RequireValue](/api/html/officeimo-html-htmlvisiblecontentresult/#method-requirevalue)
- Property [HtmlVisibleContentResult.Value](/api/html/officeimo-html-htmlvisiblecontentresult/#property-value)

### Accepted by parameters 8

- Method [HtmlComputedStyleEngine.Compute](/api/html/officeimo-html-htmlcomputedstyleengine/#method-compute-officeimo-html-htmlconversiondocument-officeimo-html-htmlcssmediacontext) parameter `document`
- Method [HtmlEditableLayoutProjector.Project](/api/html/officeimo-html-htmleditablelayoutprojector/#method-project-officeimo-html-htmlconversiondocument-officeimo-html-htmlrenderoptions-officeimo-html-htmlcssmediacontext-officeimo-html-htmleditablelayoutregionkinds-nullable-system-int32) parameter `document`
- Method [HtmlRenderEngine.Execute](/api/html/officeimo-html-htmlrenderengine/#method-execute-officeimo-html-htmlconversiondocument-officeimo-html-htmlrenderrequest-threading-cancellationtoken) parameter `document`
- Method [HtmlRenderEngine.ExecuteAsync](/api/html/officeimo-html-htmlrenderengine/#method-executeasync-officeimo-html-htmlconversiondocument-officeimo-html-htmlrenderrequest-threading-cancellationtoken) parameter `document`
- Method [HtmlRenderEngine.Render](/api/html/officeimo-html-htmlrenderengine/#method-render-officeimo-html-htmlconversiondocument-officeimo-html-htmlrenderoptions) parameter `document`
- Method [HtmlRenderEngine.RenderAsync](/api/html/officeimo-html-htmlrenderengine/#method-renderasync-officeimo-html-htmlconversiondocument-officeimo-html-htmlrenderoptions-threading-cancellationtoken) parameter `document`
- Method [HtmlRoundTripScorer.Compare](/api/html/officeimo-html-htmlroundtripscorer/#method-compare-officeimo-html-htmlconversiondocument-officeimo-html-htmlconversiondocument) parameter `sourceDocument`
- Method [HtmlRoundTripScorer.Compare](/api/html/officeimo-html-htmlroundtripscorer/#method-compare-officeimo-html-htmlconversiondocument-officeimo-html-htmlconversiondocument) parameter `targetDocument`

Filter members 

Show inherited

## Methods

`public HtmlConversionPreflight AnalyzeFor(HtmlConversionTarget target)` [#](#method-analyzefor-officeimo-html-htmlconversiontarget)

[HtmlConversionDocument.cs:248](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.cs#L248)

Predicts supported, approximated, and omitted source features for a target before artifact creation. Results are cached per prepared document and target.

Parameters

**target OfficeIMO.Html.HtmlConversionTarget required**

Returns

`HtmlConversionPreflight`

CreateDocumentForConversion 4 overloads

`public HtmlDocument CreateDocumentForConversion()` [#](#method-createdocumentforconversion)

[HtmlConversionDocument.cs:105](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.cs#L105)

Creates an independent policy-normalized DOM for the conversion profile's default media context.

Returns

`HtmlDocument`

`public HtmlDocument CreateDocumentForConversion(CancellationToken cancellationToken)` [#](#method-createdocumentforconversion-threading-cancellationtoken)

[HtmlConversionDocument.cs:109](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.cs#L109)

Creates an independent policy-normalized DOM with cooperative cancellation.

Parameters

**cancellationToken System.Threading.CancellationToken required**

Returns

`HtmlDocument`

`public HtmlDocument CreateDocumentForConversion(HtmlCssMediaContext mediaContext)` [#](#method-createdocumentforconversion-officeimo-html-htmlcssmediacontext)

[HtmlConversionDocument.cs:117](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.cs#L117)

Creates a policy-normalized DOM filtered for a target media context without reparsing source HTML or mutating shared state.

Parameters

**mediaContext OfficeIMO.Html.HtmlCssMediaContext required**

Screen or print media context selected by the target adapter.

Returns

`HtmlDocument` An independent DOM clone that the target adapter may safely mutate.

`public HtmlDocument CreateDocumentForConversion(HtmlCssMediaContext mediaContext, CancellationToken cancellationToken)` [#](#method-createdocumentforconversion-officeimo-html-htmlcssmediacontext-threading-cancellationtoken)

[HtmlConversionDocument.cs:124](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.cs#L124)

Creates an independent policy-normalized DOM for the selected media context with cooperative cancellation.

Parameters

**mediaContext OfficeIMO.Html.HtmlCssMediaContext required**

Screen or print media context selected by the target adapter.

**cancellationToken System.Threading.CancellationToken required**

Cancels normalization, cloning, media filtering and owned-DOM projection.

Returns

`HtmlDocument` An independent DOM clone that the target adapter may safely mutate.

`public Task<HtmlVisibleContentResult> CreateVisibleContentDocumentResultAsync(HtmlRenderOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-createvisiblecontentdocumentresultasync-officeimo-html-htmlrenderoptions-threading-cancellationtoken)

[HtmlConversionDocument.VisibleContent.cs:19](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.VisibleContent.cs#L19)

Creates an independent editable source without elements hidden by computed display: none, zero opacity, or a closed details element in the requested screen or print environment. The returned source keeps its original stylesheet links and bounded import contract. A supported computed image maximum width is retained as an inline hint so editable targets do not expand a captured image to its unconstrained intrinsic size.

Parameters

**options OfficeIMO.Html.HtmlRenderOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task<HtmlVisibleContentResult>`

`public HtmlConversionDocument Edit(Action<HtmlDocument> edit)` [#](#method-edit-action-officeimo-html-dom-htmldocument)

[HtmlConversionDocument.Parse.cs:75](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.Parse.cs#L75)

Edits an independent source snapshot and retains this conversion's trust, resource and fidelity options.

Parameters

**edit System.Action<OfficeIMO.Html.Dom.HtmlDocument> required**

Returns

`HtmlConversionDocument`

`public string ExportSourceHtml()` [#](#method-exportsourcehtml)

[HtmlConversionDocument.SourceExport.cs:16](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.SourceExport.cs#L16)

Serializes the source document with its effective absolute base URI so relative references still resolve against the original location when the HTML is saved elsewhere.

Returns

`string`

FromDocument 2 overloads

`public static HtmlConversionDocument FromDocument(HtmlDocument document, HtmlConversionDocumentOptions? options = null)` [#](#method-fromdocument-officeimo-html-dom-htmldocument-officeimo-html-htmlconversiondocumentoptions)

[HtmlConversionDocument.Parse.cs:56](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.Parse.cs#L56)

Creates a conversion snapshot from an owned tree without reparsing its serialized markup.

Parameters

**document OfficeIMO.Html.Dom.HtmlDocument required**

**options OfficeIMO.Html.HtmlConversionDocumentOptions? = null optional**

Returns

`HtmlConversionDocument`

`public static HtmlConversionDocument FromDocument(HtmlDocument document, HtmlConversionDocumentOptions? options, CancellationToken cancellationToken)` [#](#method-fromdocument-officeimo-html-dom-htmldocument-officeimo-html-htmlconversiondocumentoptions-threading-cancellationtoken)

[HtmlConversionDocument.Parse.cs:60](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.Parse.cs#L60)

Captures an owned tree with cooperative cancellation during validation, cloning, projection and serialization.

Parameters

**document OfficeIMO.Html.Dom.HtmlDocument required**

**options OfficeIMO.Html.HtmlConversionDocumentOptions? required**

**cancellationToken System.Threading.CancellationToken required**

Returns

`HtmlConversionDocument`

Load 2 overloads

`public static HtmlConversionDocument Load(string path, HtmlConversionDocumentOptions? options = null, Encoding? encoding = null)` [#](#method-load-string-officeimo-html-htmlconversiondocumentoptions-text-encoding)

[HtmlConversionDocument.IO.cs:6](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.IO.cs#L6)

Loads and parses an HTML file.

Parameters

**path string required**

**options OfficeIMO.Html.HtmlConversionDocumentOptions? = null optional**

**encoding System.Text.Encoding? = null optional**

Returns

`HtmlConversionDocument`

`public static HtmlConversionDocument Load(Stream stream, HtmlConversionDocumentOptions? options = null, Encoding? encoding = null)` [#](#method-load-io-stream-officeimo-html-htmlconversiondocumentoptions-text-encoding)

[HtmlConversionDocument.IO.cs:13](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.IO.cs#L13)

Loads and parses HTML from a caller-owned stream.

Parameters

**stream System.IO.Stream required**

**options OfficeIMO.Html.HtmlConversionDocumentOptions? = null optional**

**encoding System.Text.Encoding? = null optional**

Returns

`HtmlConversionDocument`

LoadAsync 2 overloads

`public static async Task<HtmlConversionDocument> LoadAsync(string path, HtmlConversionDocumentOptions? options = null, Encoding? encoding = null, CancellationToken cancellationToken = default)` [#](#method-loadasync-string-officeimo-html-htmlconversiondocumentoptions-text-encoding-threading-cancellationtoken)

Asynchronously loads and parses an HTML file.

Parameters

**path string required**

**options OfficeIMO.Html.HtmlConversionDocumentOptions? = null optional**

**encoding System.Text.Encoding? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task<HtmlConversionDocument>`

`public static async Task<HtmlConversionDocument> LoadAsync(Stream stream, HtmlConversionDocumentOptions? options = null, Encoding? encoding = null, CancellationToken cancellationToken = default)` [#](#method-loadasync-io-stream-officeimo-html-htmlconversiondocumentoptions-text-encoding-threading-cancellationtoken)

Asynchronously loads and parses HTML from a caller-owned stream.

Parameters

**stream System.IO.Stream required**

**options OfficeIMO.Html.HtmlConversionDocumentOptions? = null optional**

**encoding System.Text.Encoding? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task<HtmlConversionDocument>`

Parse 2 overloads

`public static HtmlConversionDocument Parse(string html, HtmlConversionDocumentOptions? options = null)` [#](#method-parse-string-officeimo-html-htmlconversiondocumentoptions)

[HtmlConversionDocument.Parse.cs:9](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.Parse.cs#L9)

Parses HTML and builds a shared conversion document with logical, style, resource, and normalized-output evidence.

Parameters

**html string required**

**options OfficeIMO.Html.HtmlConversionDocumentOptions? = null optional**

Returns

`HtmlConversionDocument`

`public static HtmlConversionDocument Parse(string html, HtmlConversionDocumentOptions? options, CancellationToken cancellationToken)` [#](#method-parse-string-officeimo-html-htmlconversiondocumentoptions-threading-cancellationtoken)

[HtmlConversionDocument.Parse.cs:13](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.Parse.cs#L13)

Parses inert HTML with explicit cooperative cancellation.

Parameters

**html string required**

**options OfficeIMO.Html.HtmlConversionDocumentOptions? required**

**cancellationToken System.Threading.CancellationToken required**

Returns

`HtmlConversionDocument`

`public HtmlConversionDocument WithTheme(OfficeTheme theme)` [#](#method-withtheme-officeimo-officetheme)

[HtmlConversionDocument.Theme.cs:8](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.Theme.cs#L8)

Returns an independent document with theme defaults for unstyled content. Authored CSS and inline formatting take precedence.

Parameters

**theme OfficeIMO.OfficeTheme required**

Returns

`HtmlConversionDocument`

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

## Properties

`public string SourceHtml { get; }` [#](#property-sourcehtml)

[HtmlConversionDocument.cs:91](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.cs#L91)

Original HTML supplied by the caller.

`public HtmlDocument Document { get; }` [#](#property-document)

[HtmlConversionDocument.cs:94](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.cs#L94)

Owned, immutable source DOM. Access does not normalize content, fetch resources or execute scripts.

`public HtmlConversionProfileContract ProfileContract { get; }` [#](#property-profilecontract)

[HtmlConversionDocument.cs:232](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.cs#L232)

Profile contract advertised to target adapters and galleries.

`public HtmlInputTrust Trust { get; }` [#](#property-trust)

[HtmlConversionDocument.cs:235](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.cs#L235)

Caller-assigned input trust boundary used by downstream adapters.

`public HtmlLogicalDocument LogicalDocument { get; }` [#](#property-logicaldocument)

[HtmlConversionDocument.cs:238](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.cs#L238)

Normalized logical structure used for semantic scoring and adapter planning.

`public HtmlSemanticDocument SemanticDocument { get; }` [#](#property-semanticdocument)

[HtmlConversionDocument.cs:241](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.cs#L241)

Typed semantic structure interpreted once for generic native target adapters.

`public HtmlComputedStyleSummary StyleSummary { get; }` [#](#property-stylesummary)

[HtmlConversionDocument.cs:258](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.cs#L258)

Compact computed-style capability summary.

`public HtmlResourceManifest ResourceManifest { get; }` [#](#property-resourcemanifest)

[HtmlConversionDocument.cs:261](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.cs#L261)

Raw resource manifest discovered in document order.

`public HtmlResourceDependencyPlan ResourcePlan { get; }` [#](#property-resourceplan)

[HtmlConversionDocument.cs:264](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.cs#L264)

Resource dependency plan grouped for adapters, reports, and gallery manifests.

`public Uri? BaseUri { get; }` [#](#property-baseuri)

[HtmlConversionDocument.cs:267](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.cs#L267)

Effective base URI used to resolve relative resources, including a document base element when present.

`public string NormalizedHtml { get; }` [#](#property-normalizedhtml)

[HtmlConversionDocument.cs:277](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.cs#L277)

Policy-aware normalized HTML, or an empty string when normalization was disabled.

`public IReadOnlyList<HtmlDiagnostic> Diagnostics { get; }` [#](#property-diagnostics)

[HtmlConversionDocument.cs:282](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.cs#L282)

Diagnostics emitted while lazily preparing shared conversion views.

`public string HtmlForConversion { get; }` [#](#property-htmlforconversion)

[HtmlConversionDocument.cs:289](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Html/Engine/HtmlConversionDocument.cs#L289)

HTML text target adapters should use when no adapter-specific source preference is configured.

<!-- PowerForge markdown artifact sha256:7CCECFE9EA39012F70916695FC265C7D8CA0CD274F9D18A723449AD849A15059 -->
