Skip to main content

Toc

Creates a table of content. This works next to TocItem definition.

constructor(code: string)

new Toc('Table of content').end;

textStyle(style: IStyleDefinition): Toc

Defines the text style for toc items. It allows all the available methods IStyleDefinition provides as properties.

new Toc('Table of content').textStyle({
italics: true,
fontSize: 10
}).end;

numberStyle(style: IStyleDefinition): Toc

Defines the number (page number) style for toc items. It allows all the available methods IStyleDefinition provides as properties.

new Toc('Table of content').numberStyle({
bold: true,
fontSize: 15
}).end;

textMargin(margin: number | [number, number] | [number, number, number, number]): Toc

Defines the text (toc items) margins.

new Toc('Table of content').textMargin([50, 5]).end;

Types

IToc

Toc properties (extends from IStyleDefinition).

  • readonly title: any;
  • readonly numberStyle?: IStyleDefinition;
  • readonly textStyle?: IStyleDefinition;
  • readonly textMargin?: number | [number, number] | [number, number, number, number];