Skip to content
English
  • There are no suggestions because the search field is empty.

What is the workaround for truncated footer content even when using HtmlFooter’s MaxHeight in IronPdf?

When HtmlFooter’s MaxHeight doesn’t render all your footer content, you can switch to HtmlStamper as a workaround to avoid truncation and ensure full footer output.

When using IronPdf’s HtmlFooter to add the footer content at the bottom of a PDF, setting the MaxHeight property, even to FragmentHeightcan cause the footer to be cut off.

Example:

renderer.RenderingOptions.HtmlFooter = new HtmlHeaderFooter
{
    HtmlFragment = "<div id='pdfFooter'> ... </div>",
    MaxHeight = HtmlHeaderFooter.FragmentHeight
};

Result:

The Workaround: Use HtmlStamper

Instead of using HtmlFooter, you can apply a full HTML footer after rendering using HtmlStamper.

Code:

var htmlStamper = new HtmlStamper
{
    Html = "<div id='pdfFooter'> ... </div>",
    VerticalAlignment = VerticalAlignment.Bottom
};

var pdf = renderer.RenderHtmlAsPdf("<h1>Hello, world</h1>");
pdf.ApplyStamp(htmlStamper);
pdf.SaveAs("outputWithHtmlStamper.pdf");

Result: