A Chapter is a special Section.

Namespace: iTextSharp.text
Assembly: ITextSharp (in ITextSharp.dll) Version: 4.1.6.0

Syntax

C#
public class Chapter : Section
Visual Basic
Public Class Chapter _
	Inherits Section
Visual C++
public ref class Chapter : public Section

Remarks

A chapter number has to be created using a Paragraph as title and an int as chapter number. The chapter number is shown be default. If you don't want to see the chapter number, you have to set the numberdepth to 0.

Examples

CopyC#
Paragraph title2 = new Paragraph("This is Chapter 2", FontFactory.GetFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC, new Color(0, 0, 255)));
<strong>Chapter chapter2 = new Chapter(title2, 2);
chapter2.SetNumberDepth(0);</strong>
Paragraph someText = new Paragraph("This is some text");
<strong>chapter2.Add(someText);</strong>
Paragraph title21 = new Paragraph("This is Section 1 in Chapter 2", FontFactory.GetFont(FontFactory.HELVETICA, 16, Font.BOLD, new Color(255, 0, 0)));
Section section1 = <strong>chapter2.AddSection(title21);</strong>
Paragraph someSectionText = new Paragraph("This is some silly paragraph in a chapter and/or section. It contains some text to test the functionality of Chapters and Section.");
section1.Add(someSectionText);

Inheritance Hierarchy

See Also