Search Results for

    Show / Hide Table of Contents

    Class HtmlHeaderFooter

    A HTML Header or Footer which will be printed onto every page of the PDF. This can be used to override

    When using HtmlHeaderFooter it is important to set HtmlFragment

    Merge meta-data into your HTML using any of these placeholder strings: {page} {total-pages} {url} {date} {time} {html-title} {pdf-title}

    Inheritance
    System.Object
    TextHeaderFooter
    HtmlHeaderFooter
    Implements
    System.ICloneable
    Inherited Members
    TextHeaderFooter.CenterText
    TextHeaderFooter.DrawDividerLine
    TextHeaderFooter.DrawDividerLineColor
    TextHeaderFooter.Font
    TextHeaderFooter.FontSize
    TextHeaderFooter.LeftText
    TextHeaderFooter.RightText
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ToString()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: IronPdf
    Assembly: IronPdf.dll
    Syntax
    public class HtmlHeaderFooter : TextHeaderFooter, ICloneable

    Constructors

    HtmlHeaderFooter()

    Declaration
    public HtmlHeaderFooter()

    Properties

    BaseUrl

    The Base URL all URLS in the HtmlFragment will be relative to. This includes 'src' attributes on images, scripts, style-sheets and also hrefs on hyper-links.

    Note: A base URL that points to a directory should end with a slash.

    Base URL accepts file paths as well as URLS. If no BaseUrl is given, the HtmlHeaderFooter BaseUrl will be inherited from the main HTML document where possible.

    Declaration
    public string BaseUrl { get; set; }
    Property Value
    Type Description
    System.String

    HtmlFragment

    The HTML which will be used to render the Header or Footer should be an HTML snippet rather than a complete document. It may contain styles & images.

    Merge meta-data into the HtmlFragment by putting any of these placeholder strings into the text: {page} {total-pages} {url} {date} {time} {html-title} {pdf-title}. An alternative mail-merge style using the pattern <span class='total-pages'></span> is also supported.

    HtmlFragment is a stand-alone HTML document which does not inherit styles or settings from your main HTML content unless LoadStylesAndCSSFromMainHtmlDocument is set true

    Declaration
    public string HtmlFragment { get; set; }
    Property Value
    Type Description
    System.String

    LoadStylesAndCSSFromMainHtmlDocument

    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 methods. It works for RenderHtmlAsPdf, 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

    Not supported in Docker mode.

    Declaration
    public bool LoadStylesAndCSSFromMainHtmlDocument { get; set; }
    Property Value
    Type Description
    System.Boolean

    MaxHeight

    Maximum Height of the HTML Header / Footer in millimeters. This value must be set sufficiently high to display the full HTML header / footer content.

    Declaration
    public int? MaxHeight { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Int32>

    Methods

    Clone()

    Supports System.ICloneable. Creates a deep copy of this class instance.

    Declaration
    public object Clone()
    Returns
    Type Description
    System.Object

    A deep clone of this instance. Use explicit casting to convert object back to the intended type.

    Implements

    System.ICloneable

    Inherited members

    CenterText
    DrawDividerLine
    DrawDividerLineColor
    Font
    FontSize
    LeftText
    RightText
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ToString()
    System.Object.ReferenceEquals(System.Object, System.Object)
    ☀
    ☾
    Downloads
    • Download with Nuget
    • Free 30-Day Trial Key
    In This Article
    Back to top
    Install with Nuget
    Want to deploy IronPDF to a live project for FREE?
    What’s included?
    30 days of fully-functional product
    Test and share in a live environment
    No watermarks in production
    Get your free 30-day Trial Key instantly.
    No credit card or account creation required
    Your Trial License Key has been emailed to you.
    Download IronPDF free to apply
    your Trial Licenses Key
    Install with NuGet View Licenses
    Licenses from $499. Have a question? Get in touch.