[Internal] Managing Default Placeholders in IronPDF
How to Control Automatic Placeholder Rendering in Headers and Footers
IronPDF includes several built-in placeholders designed to simplify the development process. These placeholders can be inserted into HTML content for rendering PDF or in HtmlFragment property in HtmlHeaderFooter object —and are automatically replaced with dynamic values when the PDF is rendered by the ChromePdfRenderer
.
Here is a list of the default placeholders:
-
{date}
→ Current date -
{time}
→ Current time -
{page}
→ Current page number -
{total-pages}
→ Total number of pages -
{url}
→ Document URL -
{html-title}
,{PDF-title}
,{pdf-title}
→ Document title
When these placeholders are used within an HtmlHeader
, HtmlFooter
, or an HtmlFragment
object, IronPDF will automatically interpret and replace them during PDF generation.
Preventing Placeholder Replacement
In some scenarios, users may want to display the placeholders as raw text—without IronPDF interpreting them. To avoid automatic replacement, you can slightly alter the placeholder syntax or escape it in a way that prevents IronPDF from recognizing it. For example, you might use an alternative string like {page_}
or wrap the text in a non-rendered element such as a comment or span with display:none.
This workaround ensures that the placeholders remain unchanged in the output.