Search results

Headers and Footers in Angular DocumentEditor component

26 Nov 2021 / 2 minutes to read

Document Editor supports headers and footers in its document. Each section in the document can have the following types of headers and footers:

  • First page: Used only on the first page of the section.
  • Even pages: Used on all even numbered pages in the section.
  • Default: Used on all pages of the section, where first or even pages are not applicable or not specified.

You can define this by setting format properties of the corresponding section using the following sample code.

Copied to clipboard
//Defines whether different header footer is required for first page of the section
this.documentEditor.selection.sectionFormat.differentFirstPage = true;
//Defines whether different header footer is required for odd and even pages in the section
this.documentEditor.selection.sectionFormat.differentOddAndEvenPages = true;

Double click in header or footer region to move the selection into it. You can also do this by using the following code.

Copied to clipboard
this.documentEditor.selection.goToHeader();
Copied to clipboard
this.documentEditor.selection.goToFooter();

You can define the distance of header region content from the top of the page. Refer to the following sample code.

Copied to clipboard
this.documentEditor.selection.sectionFormat.headerDistance = 36;

Same way, you can define the distance of footer region content from the bottom of the page. Refer to the following sample code.

Copied to clipboard
this.documentEditor.selection.sectionFormat.footerDistace = 36;

Move the selection to the document body from header or footer region by double clicking or tapping the document area. You can also perform this by using the following sample code.

Copied to clipboard
this.documentEditor.selection.closeHeaderFooter()

See Also