---
Product: Aspose.PDF
Platform: net
Page Type: reference
Canonical URL: https://reference.aspose.org/pdf/net/HeaderFooter
---

# HeaderFooter

## Overview

`HeaderFooter` is a class in Aspose.PDF FOSS for .NET.

Represents a header or footer that can be applied to PDF pages.

This class provides 4 methods for working with HeaderFooter objects in .NET programs.
Available methods include: `ApplyAsFooter`, `ApplyAsHeader`, `Clone`, `FromText`.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: `HorizontalAlignment`, `IsClipExtraContent`, `Margin`, `Paragraphs`, `Text`, `TextState`.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `Text` | `string` | Read/Write | The text content. |
| `TextState` | `TextState` | Read/Write | Text formatting state (font, size, color). |
| `Margin` | `MarginInfo` | Read/Write | Margins controlling the position of the header/footer text. |
| `HorizontalAlignment` | `HorizontalAlignment` | Read/Write | Horizontal alignment of the text. |
| `Paragraphs` | `Paragraphs` | Read/Write | Collection of paragraph objects (TextFragment, HtmlFragment, etc.) to render in the header/footer. |
| `IsClipExtraContent` | `bool` | Read/Write | Whether content overflowing the header/footer area is clipped. |

## Methods

| Signature | Description |
|-----------|-------------|
| `FromText(text: string)` | Create a HeaderFooter from a text string. |
| `Clone()` | Shallow clone — copies Text/TextState/ Margin/HorizontalAlignment plus shallow-copied references to every entry in Paragraphs. |
| `ApplyAsHeader(pages: Page[], substitutePageNumbers: bool)` | Apply this header/footer as a header (positioned at the top) to the given pages. |
| `ApplyAsFooter(pages: Page[], substitutePageNumbers: bool)` | Apply this header/footer as a footer (positioned at the bottom) to the given pages. |

## See Also

- [Aspose.PDF for .NET — Enterprise API Reference](https://reference.aspose.com/pdf/net/)