HtmlResourcePipeline
OfficeIMO.Html
Shared resource discovery and policy planning for OfficeIMO HTML workflows.
Inheritance
- object
- HtmlResourcePipeline
Methods
public static HtmlResourceManifest BuildManifest(string html, HtmlResourcePipelineOptions? options = null) #Parses raw HTML and builds a resource manifest.
Parameters
- html string
- options OfficeIMO.Html.HtmlResourcePipelineOptions? = null
Returns
HtmlResourceManifestpublic static HtmlResourceManifest BuildManifest(HtmlDocument document, HtmlResourcePipelineOptions? options = null) #Builds a resource manifest from a parsed document.
Parameters
- document OfficeIMO.Html.Dom.HtmlDocument
- options OfficeIMO.Html.HtmlResourcePipelineOptions? = null
Returns
HtmlResourceManifestpublic static HtmlResourceManifest BuildStylesheetManifest(string css, Uri baseUri, HtmlResourcePipelineOptions? options = null) #Parses an external stylesheet and builds the same policy-aware resource manifest used by the HTML renderer for imports, fonts, and images.
Parameters
- css string
- Stylesheet source text.
- baseUri System.Uri
- Absolute URI used to resolve relative stylesheet references.
- options OfficeIMO.Html.HtmlResourcePipelineOptions? = null
- Optional resource policy and media-context settings.
Returns
HtmlResourceManifest A manifest containing applicable imports and referenced font and image resources.public static string RewriteCssResourceUrls(string css, Func<string, HtmlResourceKind, string> rewrite) #Rewrites stylesheet imports, URL functions and image-set strings without discarding media, supports or layer conditions.
Parameters
- css string
- Stylesheet or inline declaration source.
- rewrite System.Func<string, OfficeIMO.Html.HtmlResourceKind, string>
- Maps a decoded source URI and its resource kind to a replacement URI.
Returns
string CSS with changed resource carriers rewritten; source outside those carriers is retained.public static string RewriteCssResourceUrls(string css, Func<string, HtmlResourceKind, string> rewrite, bool includeFragmentReferences) #Rewrites CSS resource URLs, optionally including local fragment references when relocating document content.
Parameters
- css string
- rewrite System.Func<string, OfficeIMO.Html.HtmlResourceKind, string>
- includeFragmentReferences bool
Returns
stringpublic static bool TryDecodeStylesheet(byte[] bytes, string? contentType, out string css, IHtmlEncodingProvider? encodingProvider = null) #Attempts to decode stylesheet bytes using CSS encoding precedence: byte-order mark, transport content-type charset, @charset, then strict UTF-8.
Parameters
- bytes byte[]
- Encoded stylesheet bytes.
- contentType string?
- Optional transport content type containing a charset.
- css string
- Decoded stylesheet text when successful.
- encodingProvider OfficeIMO.Html.Dom.IHtmlEncodingProvider? = null
- Optional web charset provider for this decoding operation.
Returns
bool true when the stylesheet encoding is supported and valid.