Examples of custom headers and footers

The following are examples of various headers and footer texts and tokens.

Example: Tokens

Header: "{Page} of {Numpages}" 

Note: If the Page is 1 and Numpages is 45, the placeholder token will result in the header text “1of45” on the first page of a 45 page document.

If you want to include spaces in order to convert the header more readable, you must specifically define the required spaces like so:

Header: "{Page} " of " {Numpages}"

The result of this header is "1 of 45".

Footer syntax

Footer: "Page {page}" of "{numpages}" 

Where the Footer is an HTTP header. The footer text will be “Page 1 of 45” on the first page of a 45 page document.

Example: Footer syntax with a single placeholder and multiple placeholder tokens and multiple placeholder custom texts

Footer: "{"Page " Page " of " Numpages}" 

The footer text will be “Page 1 of 45” on the first page of a 45 page document.

Example: Header syntax

{Documents: [{Uri: 'file:///d:/AnnualReport.msg', Header: 'This is a local header'}]}

Note that the header or footer can be plain text as the "This is a local header" text illustrates.

Header and footer style examples

Footer: "Page {page} of {numpages}"

FooterStyle: { VerticalAlignment: 'Top', HorizontalAlignment: 'Left' }

The copy image is missing

 {
	"Watermark": "Global Watermark",
	"WatermarkStyle": { "Color": "Black", "Transparency": "33", "Font": "Arial"},
	"Header": "Global header",
	"Footer": "Global footer",
	"Documents": [
		{
			"Uri": "file:///d:/AnnualReport.msg",
			"Title": "Custom title",
			"Watermark": "Local Watermark",
			"WatermarkStyle": {"Color": "Cyan", "Transparency": "55", "Font": "Algerian"},
			"Header": "This is local header",
			"HeaderStyle": { "HorizontalAlignment": "Center", "HorizontalMargin": "10", "Font": "Algerian", "FontSize": "10", "ForegroundColor": "Blue", "BackgroundColor": "Transparent",
				"Opacity": "0.75",
				"HorizontalScaling": "1"
				},
				"Footer": "This is local footer.",
				"FooterStyle": {
				"Bold": false,
				"Font": "Arial"
				}
				}
				]
		}
The copy image is missing

In this example, there is a global header and footer each being overwritten by a local, document header and footer defined later n the document section.

The document header is centered, with a 10 pixel offset margin and uses the Algerian font with a font size of 10 and a Blue font color.

The document footer style is more subdued, containing only the Arial font.

Example: Complex header with multiple tokens, placeholder custom text and quotation marks within the text

Header: "Confidential! {"Print \"date\" is:" date ". Page: " page} of {Numpages}" 

The copy image is missing

In this example, the Date is 05/06-2018, the Page is 3 and the Numpages is 23, the header text would look like this:

Confidential! Print "date" is 05.06.2018. Page: 3 of 23

Note the date formatting will depend on your local date settings.