New to Telerik UI for WinForms? Download free 30-day trial

Header and Footer

The RadPrintDocument has a build in header and footer print capabilities. Here is a list of the available properties which allow you to customize the header and footer:

  • HeaderHeight: the height of the header in pixels.

  • HeaderFont: the font of the header text.

  • LeftHeader: the text in the left part of the header.

  • MiddleHeader: the text in the middle of the header.

  • RightHeader: the text in the right part of the header.

  • ReverseHeaderOnEvenPages: swaps the places of the left and right header texts on even pages.

  • FooterHeight: the height of the footer in pixels.

  • FooterFont: the font of the footer text.

  • LeftFooter: the text in the left part of the footer.

  • MiddleFooter: the text in the middle of the footer.

  • RightFooter: the text in the right part of the footer.

  • ReverseFooterOnEvenPages: swaps the places of the left and right footer texts on even pages.

  • Logo: allows you to add logo to the header or footer. Please note that the header/footer text should contain "[Logo]" in its text in order the logo to appear.

Is an example demonstrating how to customize the header and footer:

RadPrintDocument document = new RadPrintDocument();
document.HeaderHeight = 30;
document.HeaderFont = new Font("Arial", 22);
document.Logo = System.Drawing.Image.FromFile(@"C:\MyLogo.png");
document.LeftHeader = "[Logo]";
document.MiddleHeader = "Middle header";
document.RightHeader = "Right header";
document.ReverseHeaderOnEvenPages = true;
document.FooterHeight = 30;
document.FooterFont = new Font("Arial", 22);
document.LeftFooter = "Left footer";
document.MiddleFooter = "Middle footer";
document.RightFooter = "Right footer";
document.ReverseFooterOnEvenPages = true;
document.AssociatedObject = this.radGridView1;
RadPrintPreviewDialog dialog = new RadPrintPreviewDialog(document);
dialog.Show();

Dim document As New RadPrintDocument()
document.HeaderHeight = 30
document.HeaderFont = New Drawing.Font("Arial", 22)
document.Logo = System.Drawing.Image.FromFile("C:\MyLogo.png")
document.LeftHeader = "[Logo]"
document.MiddleHeader = "Middle header"
document.RightHeader = "Right header"
document.ReverseHeaderOnEvenPages = True
document.FooterHeight = 30
document.FooterFont = New Drawing.Font("Arial", 22)
document.LeftFooter = "Left footer"
document.MiddleFooter = "Middle footer"
document.RightFooter = "Right footer"
document.ReverseFooterOnEvenPages = True
document.AssociatedObject = Me.RadGridView1
Dim dialog As New RadPrintPreviewDialog(document)
dialog.Show()

tpf-printing-support-radprintdocument-header-and-footer 001

The header and footer have some predefined special strings which can be set to any part of it and/or to make combinations of them.

  • [Page #] – Prints the number of the current page.

  • [Total Pages] – Prints the total number of pages.

  • [Date Printed] – Prints the date when the printing was started.

  • [Time Printed] – Prints the time when the printing was started.

  • [User Name] – Prints the user-name associated with the current thread (the current Windows login)).

Here is a sample:

RadPrintDocument document = new RadPrintDocument();
document.MiddleHeader = "Page [Page #] of [Total Pages]. Printed on [Date Printed] [Time Printed].";

Dim document As New RadPrintDocument()
document.MiddleHeader = "Page [Page #] of [Total Pages]. Printed on [Date Printed] [Time Printed]."

tpf-printing-support-radprintdocument-header-and-footer 002

See Also

In this article