Interface DocListener

All Superinterfaces:
AutoCloseable, ElementListener, EventListener
All Known Implementing Classes:
Document, DocWriter, FdfWriter.Wrt, HTMLWorker, HtmlWriter, PdfCopy, PdfCopyFieldsImp, PdfCopyFormsImp, PdfDocument, PdfSmartCopy, PdfStamperImp, PdfWriter, UnembedFontPdfSmartCopy

public interface DocListener extends ElementListener, AutoCloseable
A class that implements DocListener will perform some actions when some actions are performed on a Document.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Signals that the Document was closed and that no other Elements will be added.
    boolean
    Signals that an new page has to be started.
    void
    Signals that the Document has been opened and that Elements can be added.
    void
    Resets the footer of this document.
    void
    Resets the header of this document.
    void
    Sets the page number to 0.
    void
    Changes the footer of this document.
    void
    Changes the header of this document.
    boolean
    setMarginMirroring(boolean marginMirroring)
    Allows you to do left/right margin mirroring (odd/even pages)
    boolean
    setMarginMirroringTopBottom(boolean marginMirroringTopBottom)
    Parameter that allows you to do top/bottom 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
    Sets the pagesize.

    Methods inherited from interface com.lowagie.text.ElementListener

    add
  • Method Details

    • open

      void open()
      Signals that the Document has been opened and that Elements can be added.
    • close

      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.

      Specified by:
      close in interface AutoCloseable
    • newPage

      boolean newPage()
      Signals that an new page has to be started.
      Returns:
      true if the page was added, false if not.
    • setPageSize

      boolean setPageSize(Rectangle pageSize)
      Sets the pagesize.
      Parameters:
      pageSize - the new pagesize
      Returns:
      a boolean
    • setMargins

      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

      boolean setMarginMirroring(boolean marginMirroring)
      Allows you to do left/right margin mirroring (odd/even pages)
      Parameters:
      marginMirroring - left/right margin mirroring (odd/even pages)
      Returns:
      true if successful
    • setMarginMirroringTopBottom

      boolean setMarginMirroringTopBottom(boolean marginMirroringTopBottom)
      Parameter that allows you to do top/bottom margin mirroring (odd/even pages)
      Parameters:
      marginMirroringTopBottom - top/bottom margin mirroring (odd/even pages)
      Returns:
      true if successful
      Since:
      2.1.6
    • setPageCount

      void setPageCount(int pageN)
      Sets the page number.
      Parameters:
      pageN - the new page number
    • resetPageCount

      void resetPageCount()
      Sets the page number to 0.
    • setHeader

      void setHeader(HeaderFooter header)
      Changes the header of this document.
      Parameters:
      header - the new header
    • resetHeader

      void resetHeader()
      Resets the header of this document.
    • setFooter

      void setFooter(HeaderFooter footer)
      Changes the footer of this document.
      Parameters:
      footer - the new footer
    • resetFooter

      void resetFooter()
      Resets the footer of this document.