public interface PdfPageEvent
Note: do not use Document.add() inside a page event.
Modifier and Type | Method and Description |
---|---|
void |
onChapter(PdfWriter writer, Document document, float paragraphPosition, Paragraph title)
Called when a Chapter is written.
|
void |
onChapterEnd(PdfWriter writer, Document document, float paragraphPosition)
Called when the end of a Chapter is reached.
|
void |
onCloseDocument(PdfWriter writer, Document document)
Called when the document is closed.
|
void |
onEndPage(PdfWriter writer, Document document)
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 a Chunk 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 |
onSection(PdfWriter writer, Document document, float paragraphPosition, int depth, Paragraph title)
Called when a Section is written.
|
void |
onSectionEnd(PdfWriter writer, Document document, float paragraphPosition)
Called when the end of a Section is reached.
|
void |
onStartPage(PdfWriter writer, Document document)
Called when a page is initialized.
|
void onOpenDocument(PdfWriter writer, Document document)
writer
- the PdfWriter
for this document
document
- the document
void onStartPage(PdfWriter writer, Document document)
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.
Note that this method isn't called for the first page. You should apply modifications for the first page either before opening the document or by using the onOpenDocument() method.
writer
- the PdfWriter
for this document
document
- the document
void onEndPage(PdfWriter writer, Document document)
writer
- the PdfWriter
for this document
document
- the document
void onCloseDocument(PdfWriter writer, Document document)
Note that this method is called with the page number equal to the last page plus one.
writer
- the PdfWriter
for this document
document
- the document
void onParagraph(PdfWriter writer, Document document, float paragraphPosition)
paragraphPosition
will hold the height at which the paragraph will be written to. This is useful to insert bookmarks with more control.
writer
- the PdfWriter
for this document
document
- the document
paragraphPosition
- the position the paragraph will be written to
void onParagraphEnd(PdfWriter writer, Document document, float paragraphPosition)
paragraphPosition
will hold the height of the end of the paragraph.
writer
- the PdfWriter
for this document
document
- the document
paragraphPosition
- the position of the end of the paragraph
void onChapter(PdfWriter writer, Document document, float paragraphPosition, Paragraph title)
position
will hold the height at which the chapter will be written to.
writer
- the PdfWriter
for this document
document
- the document
paragraphPosition
- the position the chapter will be written to
title
- the title of the Chapter
void onChapterEnd(PdfWriter writer, Document document, float paragraphPosition)
position
will hold the height of the end of the chapter.
writer
- the PdfWriter
for this document
document
- the document
paragraphPosition
- the position the chapter will be written to
void onSection(PdfWriter writer, Document document, float paragraphPosition, int depth, Paragraph title)
position
will hold the height at which the section will be written to.
writer
- the PdfWriter
for this document
document
- the document
paragraphPosition
- the position the section will be written to
depth
- the number depth of the section
title
- the title of the section
void onSectionEnd(PdfWriter writer, Document document, float paragraphPosition)
position
will hold the height of the section end.
writer
- the PdfWriter
for this document
document
- the document
paragraphPosition
- the position the section will be written to
void onGenericTag(PdfWriter writer, Document document, Rectangle rect, String text)
Chunk
with a generic tag is written.
It is useful to pinpoint the Chunk
location to generate bookmarks, for example.
writer
- the PdfWriter
for this document
document
- the document
rect
- the Rectangle
containing the Chunk
text
- the text of the tag
Copyright © 1998–2019. All rights reserved.