class PdfPageEventForwarder implements PdfPageEvent {

    /**
     * ArrayList containing all the PageEvents that have to be executed.
     */
    protected List<PdfPageEvent> events = new ArrayList<>();

    /**
     * Add a page event to the forwarder.
     *
     * @param event an event that has to be added to the forwarder.
     */
    public void addPageEvent(PdfPageEvent event) {
        events.add(event);
    }

    /**
     * Called when the document is opened.
     *
     * @param writer   the <CODE>PdfWriter</CODE> for this document
     * @param document the document
     */
    public void onOpenDocument(PdfWriter writer, Document document) {
        PdfPageEvent event;
        for (Object event1 : events) {
            event = (PdfPageEvent) event1;
            event.onOpenDocument(writer, document);
        }
    }

    /**
     * Called when a page is initialized.
     * <p>
     * Note that if even if a page is not written this method is still called. It is preferable to use
     * <CODE>onEndPage</CODE> to avoid infinite loops.
     *
     * @param writer   the <CODE>PdfWriter</CODE> for this document
     * @param document the document
     */
    public void onStartPage(PdfWriter writer, Document document) {
        PdfPageEvent event;
        for (Object event1 : events) {
            event = (PdfPageEvent) event1;
            event.onStartPage(writer, document);
        }
    }

    /**
     * Called when a page is finished, just before being written to the document.
     *
     * @param writer   the <CODE>PdfWriter</CODE> for this document
     * @param document the document
     */
    public void onEndPage(PdfWriter writer, Document document) {
        PdfPageEvent event;
        for (Object event1 : events) {
            event = (PdfPageEvent) event1;
            event.onEndPage(writer, document);
        }
    }

    /**
     * Called when the document is closed.
     * <p>
     * Note that this method is called with the page number equal to the last page plus one.
     *
     * @param writer   the <CODE>PdfWriter</CODE> for this document
     * @param document the document
     */
    public void onCloseDocument(PdfWriter writer, Document document) {
        PdfPageEvent event;
        for (Object event1 : events) {
            event = (PdfPageEvent) event1;
            event.onCloseDocument(writer, document);
        }
    }

    /**
     * Called when a Paragraph is written.
     * <p>
     * <CODE>paragraphPosition</CODE> will hold the height at which the
     * paragraph will be written to. This is useful to insert bookmarks with more control.
     *
     * @param writer            the <CODE>PdfWriter</CODE> for this document
     * @param document          the document
     * @param paragraphPosition the position the paragraph will be written to
     */
    public void onParagraph(PdfWriter writer, Document document,
            float paragraphPosition) {
        PdfPageEvent event;
        for (Object event1 : events) {
            event = (PdfPageEvent) event1;
            event.onParagraph(writer, document, paragraphPosition);
        }
    }

    /**
     * Called when a Paragraph is written.
     * <p>
     * <CODE>paragraphPosition</CODE> will hold the height of the end of the
     * paragraph.
     *
     * @param writer            the <CODE>PdfWriter</CODE> for this document
     * @param document          the document
     * @param paragraphPosition the position of the end of the paragraph
     */
    public void onParagraphEnd(PdfWriter writer, Document document,
            float paragraphPosition) {
        PdfPageEvent event;
        for (Object event1 : events) {
            event = (PdfPageEvent) event1;
            event.onParagraphEnd(writer, document, paragraphPosition);
        }
    }

    /**
     * Called when a Chapter is written.
     * <p>
     * <CODE>position</CODE> will hold the height at which the chapter will be
     * written to.
     *
     * @param writer            the <CODE>PdfWriter</CODE> for this document
     * @param document          the document
     * @param paragraphPosition the position the chapter will be written to
     * @param title             the title of the Chapter
     */
    public void onChapter(PdfWriter writer, Document document,
            float paragraphPosition, Paragraph title) {
        PdfPageEvent event;
        for (Object event1 : events) {
            event = (PdfPageEvent) event1;
            event.onChapter(writer, document, paragraphPosition, title);
        }
    }

    /**
     * Called when the end of a Chapter is reached.
     * <p>
     * <CODE>position</CODE> will hold the height of the end of the chapter.
     *
     * @param writer   the <CODE>PdfWriter</CODE> for this document
     * @param document the document
     * @param position the position of the end of the chapter.
     */
    public void onChapterEnd(PdfWriter writer, Document document, float position) {<FILL_FUNCTION_BODY>}

    /**
     * Called when a Section is written.
     * <p>
     * <CODE>position</CODE> will hold the height at which the section will be
     * written to.
     *
     * @param writer            the <CODE>PdfWriter</CODE> for this document
     * @param document          the document
     * @param paragraphPosition the position the section will be written to
     * @param depth             the number depth of the Section
     * @param title             the title of the section
     */
    public void onSection(PdfWriter writer, Document document,
            float paragraphPosition, int depth, Paragraph title) {
        PdfPageEvent event;
        for (Object event1 : events) {
            event = (PdfPageEvent) event1;
            event.onSection(writer, document, paragraphPosition, depth, title);
        }
    }

    /**
     * Called when the end of a Section is reached.
     * <p>
     * <CODE>position</CODE> will hold the height of the section end.
     *
     * @param writer   the <CODE>PdfWriter</CODE> for this document
     * @param document the document
     * @param position the position of the end of the section
     */
    public void onSectionEnd(PdfWriter writer, Document document, float position) {
        PdfPageEvent event;
        for (Object event1 : events) {
            event = (PdfPageEvent) event1;
            event.onSectionEnd(writer, document, position);
        }
    }

    /**
     * Called when a <CODE>Chunk</CODE> with a generic tag is written.
     * <p>
     * It is useful to pinpoint the <CODE>Chunk</CODE> location to generate bookmarks, for example.
     *
     * @param writer   the <CODE>PdfWriter</CODE> for this document
     * @param document the document
     * @param rect     the <CODE>Rectangle</CODE> containing the <CODE>Chunk
     *                 </CODE>
     * @param text     the text of the tag
     */
    public void onGenericTag(PdfWriter writer, Document document,
            Rectangle rect, String text) {
        PdfPageEvent event;
        for (Object event1 : events) {
            event = (PdfPageEvent) event1;
            event.onGenericTag(writer, document, rect, text);
        }
    }
}

        PdfPageEvent event;
        for (Object event1 : events) {
            event = (PdfPageEvent) event1;
            event.onChapterEnd(writer, document, position);
        }
    
<no_super_class>