Class PdfPageEventForwarder
- All Implemented Interfaces:
PdfPageEvent
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List
<PdfPageEvent> ArrayList containing all the PageEvents that have to be executed. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPageEvent
(PdfPageEvent event) Add a page event to the forwarder.void
Called when a Chapter is written.void
onChapterEnd
(PdfWriter writer, Document document, float position) Called when the end of a Chapter is reached.void
onCloseDocument
(PdfWriter writer, Document document) Called when the document is closed.void
Called when a page is finished, just before being written to the document.void
onGenericTag
(PdfWriter writer, Document document, Rectangle rect, String text) Called when aChunk
with a generic tag is written.void
onOpenDocument
(PdfWriter writer, Document document) Called when the document is opened.void
onParagraph
(PdfWriter writer, Document document, float paragraphPosition) Called when a Paragraph is written.void
onParagraphEnd
(PdfWriter writer, Document document, float paragraphPosition) Called when a Paragraph is written.void
Called when a Section is written.void
onSectionEnd
(PdfWriter writer, Document document, float position) Called when the end of a Section is reached.void
onStartPage
(PdfWriter writer, Document document) Called when a page is initialized.
-
Field Details
-
events
ArrayList containing all the PageEvents that have to be executed.
-
-
Constructor Details
-
PdfPageEventForwarder
public PdfPageEventForwarder()
-
-
Method Details
-
addPageEvent
Add a page event to the forwarder.- Parameters:
event
- an event that has to be added to the forwarder.
-
onOpenDocument
Called when the document is opened.- Specified by:
onOpenDocument
in interfacePdfPageEvent
- Parameters:
writer
- thePdfWriter
for this documentdocument
- the document
-
onStartPage
Called when a page is initialized.Note that if even if a page is not written this method is still called. It is preferable to use
onEndPage
to avoid infinite loops.- Specified by:
onStartPage
in interfacePdfPageEvent
- Parameters:
writer
- thePdfWriter
for this documentdocument
- the document
-
onEndPage
Called when a page is finished, just before being written to the document.- Specified by:
onEndPage
in interfacePdfPageEvent
- Parameters:
writer
- thePdfWriter
for this documentdocument
- the document
-
onCloseDocument
Called when the document is closed.Note that this method is called with the page number equal to the last page plus one.
- Specified by:
onCloseDocument
in interfacePdfPageEvent
- Parameters:
writer
- thePdfWriter
for this documentdocument
- the document
-
onParagraph
Called when a Paragraph is written.paragraphPosition
will hold the height at which the paragraph will be written to. This is useful to insert bookmarks with more control.- Specified by:
onParagraph
in interfacePdfPageEvent
- Parameters:
writer
- thePdfWriter
for this documentdocument
- the documentparagraphPosition
- the position the paragraph will be written to
-
onParagraphEnd
Called when a Paragraph is written.paragraphPosition
will hold the height of the end of the paragraph.- Specified by:
onParagraphEnd
in interfacePdfPageEvent
- Parameters:
writer
- thePdfWriter
for this documentdocument
- the documentparagraphPosition
- the position of the end of the paragraph
-
onChapter
public void onChapter(PdfWriter writer, Document document, float paragraphPosition, Paragraph title) Called when a Chapter is written.position
will hold the height at which the chapter will be written to.- Specified by:
onChapter
in interfacePdfPageEvent
- Parameters:
writer
- thePdfWriter
for this documentdocument
- the documentparagraphPosition
- the position the chapter will be written totitle
- the title of the Chapter
-
onChapterEnd
Called when the end of a Chapter is reached.position
will hold the height of the end of the chapter.- Specified by:
onChapterEnd
in interfacePdfPageEvent
- Parameters:
writer
- thePdfWriter
for this documentdocument
- the documentposition
- the position of the end of the chapter.
-
onSection
public void onSection(PdfWriter writer, Document document, float paragraphPosition, int depth, Paragraph title) Called when a Section is written.position
will hold the height at which the section will be written to.- Specified by:
onSection
in interfacePdfPageEvent
- Parameters:
writer
- thePdfWriter
for this documentdocument
- the documentparagraphPosition
- the position the section will be written todepth
- the number depth of the Sectiontitle
- the title of the section
-
onSectionEnd
Called when the end of a Section is reached.position
will hold the height of the section end.- Specified by:
onSectionEnd
in interfacePdfPageEvent
- Parameters:
writer
- thePdfWriter
for this documentdocument
- the documentposition
- the position of the end of the section
-
onGenericTag
Called when aChunk
with a generic tag is written.It is useful to pinpoint the
Chunk
location to generate bookmarks, for example.- Specified by:
onGenericTag
in interfacePdfPageEvent
- Parameters:
writer
- thePdfWriter
for this documentdocument
- the documentrect
- theRectangle
containing theChunk
text
- the text of the tag
-