## com.lowagie.text
Interface DocListener

All Superinterfaces:
  ElementListener, EventListener

All Known Implementing Classes:
  Document, DocWriter, HTMLWorker, HtmlWriter, PdfDocument, RtfWriter, RtfWriter2, XmlWriter

public interface DocListener
extends ElementListener

A class that implements `DocListener` will perform some actions when some actions are performed on a `Document`.

See Also:
  `ElementListener`, `Document`, `DocWriter`

Method Summary
`boolean` `add(Watermark watermark)` Signals that a `Watermark` was added to the `Document`.
`void` `clearTextWrap()` Clears text wrapping around images (if applicable).
`void` `close()` Signals that the `Document` was closed and that no other `Elements` will be added.
`boolean` `newPage()` Signals that an new page has to be started.
`void` `open()` Signals that the `Document` has been opened and that `Elements` can be added.
`void` `removeWatermark()` Signals that a `Watermark` was removed from the `Document`.
`void` `resetFooter()` Resets the footer of this document.
`void` `resetHeader()` Resets the header of this document.
`void` `resetPageCount()` Sets the page number to 0.
`void` `setFooter(HeaderFooter footer)` Changes the footer of this document.
`void` `setHeader(HeaderFooter header)` Changes the header of this document.
`boolean` `setMarginMirroring(boolean marginMirroring)` Parameter that allows you to do margin mirroring (odd/even pages)
`boolean` `setMargins(float marginLeft, float marginRight, float marginTop, float marginBottom)` Sets the margins.
`void` `setPageCount(int pageN)` Sets the page number.
`boolean` `setPageSize(Rectangle pageSize)` Sets the pagesize.

Methods inherited from interface com.lowagie.text.ElementListener
`add`

Method Detail

### open

    public void open()

  Signals that the `Document` has been opened and that `Elements` can be added.

### setPageSize

    public boolean setPageSize(Rectangle pageSize)

  Sets the pagesize.

  Parameters:
    `pageSize` - the new pagesize
  Returns:
    a `boolean`

### add

    public boolean add(Watermark watermark)

  Signals that a `Watermark` was added to the `Document`.

  Parameters:
    `watermark` - the Watermark object
  Returns:
    `true` if the element was added, `false` if not.

### removeWatermark

    public void removeWatermark()

  Signals that a `Watermark` was removed from the `Document`.

### setMargins

    public boolean setMargins(float marginLeft,
                              float marginRight,
                              float marginTop,
                              float marginBottom)

  Sets the margins.

  Parameters:
    `marginLeft` - the margin on the left
    `marginRight` - the margin on the right
    `marginTop` - the margin on the top
    `marginBottom` - the margin on the bottom
  Returns:
    a `boolean`

### setMarginMirroring

    public boolean setMarginMirroring(boolean marginMirroring)

  Parameter that allows you to do margin mirroring (odd/even pages)

  Parameters:
    `marginMirroring` -
  Returns:
    true if succesfull

### newPage

    public boolean newPage()
                    throws DocumentException

  Signals that an new page has to be started.

  Returns:
    `true` if the page was added, `false` if not.
  Throws:
    `DocumentException` - when a document isn't open yet, or has been closed

### setHeader

    public void setHeader(HeaderFooter header)

  Changes the header of this document.

  Parameters:
    `header` - the new header

### resetHeader

    public void resetHeader()

  Resets the header of this document.

### setFooter

    public void setFooter(HeaderFooter footer)

  Changes the footer of this document.

  Parameters:
    `footer` - the new footer

### resetFooter

    public void resetFooter()

  Resets the footer of this document.

### resetPageCount

    public void resetPageCount()

  Sets the page number to 0.

### setPageCount

    public void setPageCount(int pageN)

  Sets the page number.

  Parameters:
    `pageN` - the new page number

### clearTextWrap

    public void clearTextWrap()
                       throws DocumentException

  Clears text wrapping around images (if applicable). Method suggested by Pelikan Stephan

  Throws:
    `DocumentException`

### close

    public void close()

  Signals that the `Document` was closed and that no other `Elements` will be added.

  The outputstream of every writer implementing `DocListener` will be closed.