Table of Contents

Class PdfPageEventForwarder

Namespace
iTextSharp.text.pdf.events
Assembly
iTextSharp.LGPLv2.Core.dll

If you want to add more than one page eventa to a PdfWriter, you have to construct a PdfPageEventForwarder, add the different events to this object and add the forwarder to the PdfWriter.

public class PdfPageEventForwarder : IPdfPageEvent
Inheritance
PdfPageEventForwarder
Implements
Inherited Members

Constructors

PdfPageEventForwarder()

public PdfPageEventForwarder()

Fields

Events

ArrayList containing all the PageEvents that have to be executed.

protected List<IPdfPageEvent> Events

Field Value

List<IPdfPageEvent>

Methods

AddPageEvent(IPdfPageEvent)

Add a page eventa to the forwarder.

public void AddPageEvent(IPdfPageEvent eventa)

Parameters

eventa IPdfPageEvent

an eventa that has to be added to the forwarder.

OnChapter(PdfWriter, Document, float, Paragraph)

Called when a Chapter is written. position will hold the height at which the chapter will be written to. the PdfWriter for this document the document the position the chapter will be written to the title of the Chapter

public virtual void OnChapter(PdfWriter writer, Document document, float paragraphPosition, Paragraph title)

Parameters

writer PdfWriter
document Document
paragraphPosition float
title Paragraph

OnChapterEnd(PdfWriter, Document, float)

Called when the end of a Chapter is reached. position will hold the height of the end of the chapter. the PdfWriter for this document the document the position of the end of the chapter.

public virtual void OnChapterEnd(PdfWriter writer, Document document, float paragraphPosition)

Parameters

writer PdfWriter
document Document
paragraphPosition float

OnCloseDocument(PdfWriter, Document)

Called when the document is closed. Note that this method is called with the page number equal to the last page plus one. the PdfWriter for this document the document

public virtual void OnCloseDocument(PdfWriter writer, Document document)

Parameters

writer PdfWriter
document Document

OnEndPage(PdfWriter, Document)

Called when a page is finished, just before being written to the document. the PdfWriter for this document the document

public virtual void OnEndPage(PdfWriter writer, Document document)

Parameters

writer PdfWriter
document Document

OnGenericTag(PdfWriter, Document, Rectangle, string)

Called when a Chunk with a generic tag is written. It is usefull to pinpoint the Chunk location to generate bookmarks, for example. the PdfWriter for this document the document the Rectangle containing the Chunk the text of the tag

public virtual void OnGenericTag(PdfWriter writer, Document document, Rectangle rect, string text)

Parameters

writer PdfWriter
document Document
rect Rectangle
text string

OnOpenDocument(PdfWriter, Document)

Called when the document is opened. the PdfWriter for this document the document

public virtual void OnOpenDocument(PdfWriter writer, Document document)

Parameters

writer PdfWriter
document Document

OnParagraph(PdfWriter, Document, float)

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. the PdfWriter for this document the document the position the paragraph will be written to

public virtual void OnParagraph(PdfWriter writer, Document document, float paragraphPosition)

Parameters

writer PdfWriter
document Document
paragraphPosition float

OnParagraphEnd(PdfWriter, Document, float)

Called when a Paragraph is written. paragraphPosition will hold the height of the end of the paragraph. the PdfWriter for this document the document the position of the end of the paragraph

public virtual void OnParagraphEnd(PdfWriter writer, Document document, float paragraphPosition)

Parameters

writer PdfWriter
document Document
paragraphPosition float

OnSection(PdfWriter, Document, float, int, Paragraph)

Called when a Section is written. position will hold the height at which the section will be written to. the PdfWriter for this document the document the position the section will be written to the number depth of the Section the title of the section

public virtual void OnSection(PdfWriter writer, Document document, float paragraphPosition, int depth, Paragraph title)

Parameters

writer PdfWriter
document Document
paragraphPosition float
depth int
title Paragraph

OnSectionEnd(PdfWriter, Document, float)

Called when the end of a Section is reached. position will hold the height of the section end. the PdfWriter for this document the document the position of the end of the section

public virtual void OnSectionEnd(PdfWriter writer, Document document, float paragraphPosition)

Parameters

writer PdfWriter
document Document
paragraphPosition float

OnStartPage(PdfWriter, Document)

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. the PdfWriter for this document the document

public virtual void OnStartPage(PdfWriter writer, Document document)

Parameters

writer PdfWriter
document Document