Click or drag to resize

HtmlHeaderFooterLoadStylesAndCSSFromMainHtmlDocument Field

Loads style code blocks and links to CSS style sheets from the main HTML document (which provides the PDF content) into the HtmlHeaderFooter .

By default, Html Headers and Footers are stand-alone HTML documents with their own default styles. Setting LoadStylesAndCSSFromMainHtmlDocument to true will attempt to load all STYLE and LINK tags from the main HTML document (which renders teh PDF) into the HtmlHeaderFooter.

If your main HTML document contains complex CSS frameworks, styles the HEAD or BODY element heavily or loads CSS from javascript then this method may not work as intended.

This feature is not available for RenderUrlAsPdf(String) and other RenderUrlAsPdf methods. It works for HTMLToPdf and HtmlFileToPdf conversions only.

It is often preferable to load style sheets explicitly into your HTML Headers and Footers as STYLE and LINK tags within the HtmlFragment for granular control

Namespace:  IronPdf
Assembly:  IronPdf (in IronPdf.dll) Version: 5.1.1.20965 (5.1.1.2)
Syntax
public bool LoadStylesAndCSSFromMainHtmlDocument

Field Value

Type: Boolean
See Also