org.apache.fop.render.intermediate

## Class AbstractIFDocumentHandler

- java.lang.Object
- - org.apache.fop.render.intermediate.AbstractIFDocumentHandler

- All Implemented Interfaces:
    IFDocumentHandler
  Direct Known Subclasses:
    AbstractBinaryWritingIFDocumentHandler, AbstractXMLWritingIFDocumentHandler

      public abstract class AbstractIFDocumentHandler
      extends Object
      implements IFDocumentHandler

  Abstract base class for `IFDocumentHandler` implementations.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractIFDocumentHandler(IFContext context)` Default constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `endDocumentHeader()` Indicates the end of the document header.
    `void` | `endDocumentTrailer()` Indicates the end of the document trailer.
    `void` | `endPageHeader()` Indicates the end of the page header.
    `void` | `endPageTrailer()` Indicates the end of the page trailer.
    `IFContext` | `getContext()` Returns the associated intermediate format context object.
    `IFDocumentNavigationHandler` | `getDocumentNavigationHandler()` Returns a document navigation handler if this feature is supported.
    `StructureTreeEventHandler` | `getStructureTreeEventHandler()`
    `FOUserAgent` | `getUserAgent()` Returns the associated user agent.
    `void` | `setDocumentLocale(Locale locale)`
    `void` | `startDocument()` Indicates the start of a document.
    `void` | `startDocumentHeader()` Indicates the start of the document header.
    `void` | `startDocumentTrailer()` Indicates the start of the document trailer.
    `void` | `startPageHeader()` Indicates the start of the page header.
    `void` | `startPageTrailer()` Indicates the start of the page trailer.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.fop.render.intermediate.IFDocumentHandler

      `endDocument, endPage, endPageContent, endPageSequence, getConfigurator, getFontInfo, getMimeType, handleExtensionObject, setDefaultFontInfo, setFontInfo, setResult, startPage, startPageContent, startPageSequence, supportsPagesOutOfOrder`

- - ### Constructor Detail

    - #### AbstractIFDocumentHandler

          protected AbstractIFDocumentHandler(IFContext context)

      Default constructor.

  - ### Method Detail

    - #### getContext

          public IFContext getContext()

      Returns the associated intermediate format context object.
      Specified by:
        `getContext` in interface `IFDocumentHandler`
      Returns:
        the context object

    - #### getUserAgent

          public FOUserAgent getUserAgent()

      Returns the associated user agent.
      Returns:
        the user agent

    - #### getStructureTreeEventHandler

          public StructureTreeEventHandler getStructureTreeEventHandler()

      Specified by:
        `getStructureTreeEventHandler` in interface `IFDocumentHandler`
      Returns:
        the structure tree builder

    - #### getDocumentNavigationHandler

          public IFDocumentNavigationHandler getDocumentNavigationHandler()

      Returns a document navigation handler if this feature is supported.
      Specified by:
        `getDocumentNavigationHandler` in interface `IFDocumentHandler`
      Returns:
        the document navigation handler or null if not supported

    - #### startDocument

          public void startDocument()
                             throws IFException

      Indicates the start of a document. This method may only be called once before any other event method.
      Specified by:
        `startDocument` in interface `IFDocumentHandler`
      Throws:
        `IFException` - if an error occurs while handling this event

    - #### setDocumentLocale

          public void setDocumentLocale(Locale locale)

      Specified by:
        `setDocumentLocale` in interface `IFDocumentHandler`
      Parameters:
        `locale` - Locale of the document.

    - #### startDocumentHeader

          public void startDocumentHeader()
                                   throws IFException

      Indicates the start of the document header. This method is called right after the `IFDocumentHandler.startDocument()` method. Extensions sent to this painter between `IFDocumentHandler.startDocumentHeader()` and `IFDocumentHandler.endDocumentHeader()` apply to the document as a whole (like document metadata).
      Specified by:
        `startDocumentHeader` in interface `IFDocumentHandler`
      Throws:
        `IFException` - if an error occurs while handling this event

    - #### endDocumentHeader

          public void endDocumentHeader()
                                 throws IFException

      Indicates the end of the document header. This method is called before the first page sequence.
      Specified by:
        `endDocumentHeader` in interface `IFDocumentHandler`
      Throws:
        `IFException` - if an error occurs while handling this event

    - #### startDocumentTrailer

          public void startDocumentTrailer()
                                    throws IFException

      Indicates the start of the document trailer. This method is called after the last page sequence. Extensions sent to the painter between `IFDocumentHandler.startDocumentTrailer()` and `IFDocumentHandler.endDocumentTrailer()` apply to the document as a whole and is used for document-level content that is only known after all pages have been rendered (like named destinations or the bookmark tree).
      Specified by:
        `startDocumentTrailer` in interface `IFDocumentHandler`
      Throws:
        `IFException` - if an error occurs while handling this event

    - #### endDocumentTrailer

          public void endDocumentTrailer()
                                  throws IFException

      Indicates the end of the document trailer. This method is called right before the `IFDocumentHandler.endDocument()` method.
      Specified by:
        `endDocumentTrailer` in interface `IFDocumentHandler`
      Throws:
        `IFException` - if an error occurs while handling this event

    - #### startPageHeader

          public void startPageHeader()
                               throws IFException

      Indicates the start of the page header.
      Specified by:
        `startPageHeader` in interface `IFDocumentHandler`
      Throws:
        `IFException` - if an error occurs while handling this event

    - #### endPageHeader

          public void endPageHeader()
                             throws IFException

      Indicates the end of the page header.
      Specified by:
        `endPageHeader` in interface `IFDocumentHandler`
      Throws:
        `IFException` - if an error occurs while handling this event

    - #### startPageTrailer

          public void startPageTrailer()
                                throws IFException

      Indicates the start of the page trailer. The page trailer is used for writing down page elements which are only know after handling the page itself (like PDF targets).
      Specified by:
        `startPageTrailer` in interface `IFDocumentHandler`
      Throws:
        `IFException` - if an error occurs while handling this event

    - #### endPageTrailer

          public void endPageTrailer()
                              throws IFException

      Indicates the end of the page trailer.
      Specified by:
        `endPageTrailer` in interface `IFDocumentHandler`
      Throws:
        `IFException` - if an error occurs while handling this event

Copyright © 2025 Apache Software Foundation. All rights reserved.