Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

HtmlConversionDocument

OfficeIMO.Html

Namespace
OfficeIMO.Html
Assembly
OfficeIMO.Html
Source revision
be6c300e4ab1 with working tree changes
Modifiers
sealed

Canonical OfficeIMO HTML conversion document shared by target adapters.

Inheritance

  • object
  • HtmlConversionDocument

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.

Accepted by parameters 8

Methods

public HtmlConversionPreflight AnalyzeFor(HtmlConversionTarget target) #

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
CreateDocumentForConversion 4 overloads
public HtmlDocument CreateDocumentForConversion() #

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

Returns

HtmlDocument
public HtmlDocument CreateDocumentForConversion(CancellationToken cancellationToken) #

Creates an independent policy-normalized DOM with cooperative cancellation.

Parameters

cancellationToken System.Threading.CancellationToken required

Returns

HtmlDocument
public HtmlDocument CreateDocumentForConversion(HtmlCssMediaContext mediaContext) #

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) #

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) #

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
public HtmlConversionDocument Edit(Action<HtmlDocument> edit) #

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

Parameters

edit System.Action<OfficeIMO.Html.Dom.HtmlDocument> required
public string ExportSourceHtml() #

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) #

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
public static HtmlConversionDocument FromDocument(HtmlDocument document, HtmlConversionDocumentOptions? options, CancellationToken cancellationToken) #

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
Load 2 overloads
public static HtmlConversionDocument Load(string path, HtmlConversionDocumentOptions? options = null, Encoding? encoding = null) #

Loads and parses an HTML file.

Parameters

path string required
options OfficeIMO.Html.HtmlConversionDocumentOptions? = null optional
encoding System.Text.Encoding? = null optional
public static HtmlConversionDocument Load(Stream stream, HtmlConversionDocumentOptions? options = null, Encoding? encoding = null) #

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
LoadAsync 2 overloads
public static async Task<HtmlConversionDocument> LoadAsync(string path, HtmlConversionDocumentOptions? options = null, Encoding? encoding = null, CancellationToken cancellationToken = default) #

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
public static async Task<HtmlConversionDocument> LoadAsync(Stream stream, HtmlConversionDocumentOptions? options = null, Encoding? encoding = null, CancellationToken cancellationToken = default) #

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
Parse 2 overloads
public static HtmlConversionDocument Parse(string html, HtmlConversionDocumentOptions? options = null) #

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
public static HtmlConversionDocument Parse(string html, HtmlConversionDocumentOptions? options, CancellationToken cancellationToken) #

Parses inert HTML with explicit cooperative cancellation.

Parameters

html string required
options OfficeIMO.Html.HtmlConversionDocumentOptions? required
cancellationToken System.Threading.CancellationToken required
public HtmlConversionDocument WithTheme(OfficeTheme theme) #

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

Parameters

theme OfficeIMO.OfficeTheme required

Properties

public string SourceHtml { get; } #

Original HTML supplied by the caller.

public HtmlDocument Document { get; } #

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

public HtmlConversionProfileContract ProfileContract { get; } #

Profile contract advertised to target adapters and galleries.

public HtmlInputTrust Trust { get; } #

Caller-assigned input trust boundary used by downstream adapters.

public HtmlLogicalDocument LogicalDocument { get; } #

Normalized logical structure used for semantic scoring and adapter planning.

public HtmlSemanticDocument SemanticDocument { get; } #

Typed semantic structure interpreted once for generic native target adapters.

public HtmlComputedStyleSummary StyleSummary { get; } #

Compact computed-style capability summary.

public HtmlResourceManifest ResourceManifest { get; } #

Raw resource manifest discovered in document order.

public HtmlResourceDependencyPlan ResourcePlan { get; } #

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

public Uri? BaseUri { get; } #

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

public string NormalizedHtml { get; } #

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

public IReadOnlyList<HtmlDiagnostic> Diagnostics { get; } #

Diagnostics emitted while lazily preparing shared conversion views.

public string HtmlForConversion { get; } #

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