Package com.itextpdf.text
Class Chapter
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<Element>
-
- com.itextpdf.text.Section
-
- com.itextpdf.text.Chapter
-
- All Implemented Interfaces:
Indentable
,Element
,LargeElement
,IAccessibleElement
,TextElementArray
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<Element>
,java.util.Collection<Element>
,java.util.List<Element>
,java.util.RandomAccess
- Direct Known Subclasses:
ChapterAutoNumber
public class Chapter extends Section
AChapter
is a specialSection
.A chapter number has to be created using a
Paragraph
as title and anint
as chapter number. The chapter number is shown by default. If you don't want to see the chapter number, you have to set the numberdepth to 0.Example:
Paragraph title2 = new Paragraph("This is Chapter 2", FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC, new Color(0, 0, 255))); Chapter chapter2 = new Chapter(title2, 2); chapter2.setNumberDepth(0); Paragraph someText = new Paragraph("This is some text"); chapter2.add(someText); 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 = chapter2.addSection(title21); 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);
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
-
Fields inherited from class com.itextpdf.text.Section
addedCompletely, bookmarkOpen, bookmarkTitle, complete, indentation, indentationLeft, indentationRight, notAddedYet, numberDepth, numbers, numberStyle, NUMBERSTYLE_DOTTED, NUMBERSTYLE_DOTTED_WITHOUT_FINAL_DOT, subsections, title, triggerNewPage
-
Fields inherited from interface com.itextpdf.text.Element
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, BODY, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CHAPTER, CHUNK, CREATIONDATE, CREATOR, DIV, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LANGUAGE, LIST, LISTITEM, MARKED, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, SECTION, SUBJECT, TITLE, WRITABLE_DIRECT, YMARK
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isNestable()
Checks if this element is nestable.int
type()
Gets the type of the text element.-
Methods inherited from class com.itextpdf.text.Section
add, add, addAll, addMarkedSection, addSection, addSection, addSection, addSection, addSection, addSection, addSection, addSection, constructTitle, flushContent, getAccessibleAttribute, getAccessibleAttributes, getBookmarkTitle, getChunks, getDepth, getId, getIndentation, getIndentationLeft, getIndentationRight, getNumberDepth, getNumberStyle, getRole, getTitle, isAddedCompletely, isBookmarkOpen, isChapter, isComplete, isContent, isInline, isNotAddedYet, isSection, isTriggerNewPage, newPage, process, setAccessibleAttribute, setAddedCompletely, setBookmarkOpen, setBookmarkTitle, setChapterNumber, setComplete, setId, setIndentation, setIndentationLeft, setIndentationRight, setNotAddedYet, setNumberDepth, setNumberStyle, setRole, setTitle, setTriggerNewPage
-
Methods inherited from class java.util.ArrayList
addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Chapter
public Chapter(int number)
Constructs a newChapter
.- Parameters:
number
- the Chapter number
-
Chapter
public Chapter(Paragraph title, int number)
Constructs a newChapter
.- Parameters:
title
- the Chapter title (as aParagraph
)number
- the Chapter number
-
Chapter
public Chapter(java.lang.String title, int number)
Constructs a newChapter
.- Parameters:
title
- the Chapter title (as aString
)number
- the Chapter number
-
-
Method Detail
-
type
public int type()
Gets the type of the text element.
-
isNestable
public boolean isNestable()
Description copied from interface:Element
Checks if this element is nestable.- Specified by:
isNestable
in interfaceElement
- Overrides:
isNestable
in classSection
- Returns:
- true if this element can be nested inside other elements.
- Since:
- iText 2.0.8
- See Also:
Element.isNestable()
-
-