org.apache.fop.render

## Class RendererFactory

- java.lang.Object
- - org.apache.fop.render.RendererFactory

-     public class RendererFactory
      extends Object

  Factory for FOEventHandlers and Renderers.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RendererFactory(boolean rendererPreferred)` Main constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addDocumentHandlerMaker(AbstractIFDocumentHandlerMaker maker)` Add a new document handler maker.
    `void` | `addDocumentHandlerMaker(String className)` Add a new document handler maker.
    `void` | `addFOEventHandlerMaker(AbstractFOEventHandlerMaker maker)` Add a new FOEventHandlerMaker.
    `void` | `addFOEventHandlerMaker(String className)` Add a new FOEventHandlerMaker.
    `void` | `addRendererMaker(AbstractRendererMaker maker)` Add a new RendererMaker.
    `void` | `addRendererMaker(String className)` Add a new RendererMaker.
    `IFDocumentHandler` | `createDocumentHandler(FOUserAgent userAgent, String outputFormat)` Creates a `IFDocumentHandler` object based on the desired output format.
    `FOEventHandler` | `createFOEventHandler(FOUserAgent userAgent, String outputFormat, OutputStream out)` Creates FOEventHandler instances based on the desired output.
    `Renderer` | `createRenderer(FOUserAgent userAgent, String outputFormat)` Creates a Renderer object based on render-type desired
    `AbstractFOEventHandlerMaker` | `getFOEventHandlerMaker(String mime)` Returns a FOEventHandlerMaker which handles the given MIME type.
    `AbstractRendererMaker` | `getRendererMaker(String mime)` Returns a RendererMaker which handles the given MIME type.
    `boolean` | `isRendererPreferred()` Indicates whether a `Renderer` is preferred over a `IFDocumentHandler` if both are available for the same MIME type.
    `String[]` | `listSupportedMimeTypes()`

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

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

- - ### Constructor Detail

    - #### RendererFactory

          public RendererFactory(boolean rendererPreferred)

      Main constructor.
      Parameters:
        `rendererPreferred` - Controls whether a `Renderer` is preferred over a `IFDocumentHandler` if both are available for the same MIME type. True to prefer the `Renderer`, false to prefer the `IFDocumentHandler`.

  - ### Method Detail

    - #### isRendererPreferred

          public boolean isRendererPreferred()

      Indicates whether a `Renderer` is preferred over a `IFDocumentHandler` if both are available for the same MIME type.
      Returns:
        true if the `Renderer` is preferred, false if the `IFDocumentHandler` is preferred.

    - #### addRendererMaker

          public void addRendererMaker(AbstractRendererMaker maker)

      Add a new RendererMaker. If another maker has already been registered for a particular MIME type, this call overwrites the existing one.
      Parameters:
        `maker` - the RendererMaker

    - #### addFOEventHandlerMaker

          public void addFOEventHandlerMaker(AbstractFOEventHandlerMaker maker)

      Add a new FOEventHandlerMaker. If another maker has already been registered for a particular MIME type, this call overwrites the existing one.
      Parameters:
        `maker` - the FOEventHandlerMaker

    - #### addDocumentHandlerMaker

          public void addDocumentHandlerMaker(AbstractIFDocumentHandlerMaker maker)

      Add a new document handler maker. If another maker has already been registered for a particular MIME type, this call overwrites the existing one.
      Parameters:
        `maker` - the intermediate format document handler maker

    - #### addRendererMaker

          public void addRendererMaker(String className)

      Add a new RendererMaker. If another maker has already been registered for a particular MIME type, this call overwrites the existing one.
      Parameters:
        `className` - the fully qualified class name of the RendererMaker

    - #### addFOEventHandlerMaker

          public void addFOEventHandlerMaker(String className)

      Add a new FOEventHandlerMaker. If another maker has already been registered for a particular MIME type, this call overwrites the existing one.
      Parameters:
        `className` - the fully qualified class name of the FOEventHandlerMaker

    - #### addDocumentHandlerMaker

          public void addDocumentHandlerMaker(String className)

      Add a new document handler maker. If another maker has already been registered for a particular MIME type, this call overwrites the existing one.
      Parameters:
        `className` - the fully qualified class name of the document handler maker

    - #### getRendererMaker

          public AbstractRendererMaker getRendererMaker(String mime)

      Returns a RendererMaker which handles the given MIME type.
      Parameters:
        `mime` - the requested output format
      Returns:
        the requested RendererMaker or null if none is available

    - #### getFOEventHandlerMaker

          public AbstractFOEventHandlerMaker getFOEventHandlerMaker(String mime)

      Returns a FOEventHandlerMaker which handles the given MIME type.
      Parameters:
        `mime` - the requested output format
      Returns:
        the requested FOEventHandlerMaker or null if none is available

    - #### createRenderer

          public Renderer createRenderer(FOUserAgent userAgent,
                                         String outputFormat)
                                  throws FOPException

      Creates a Renderer object based on render-type desired
      Parameters:
        `userAgent` - the user agent for access to configuration
        `outputFormat` - the MIME type of the output format to use (ex. "application/pdf").
      Returns:
        the new Renderer instance
      Throws:
        `FOPException` - if the renderer cannot be properly constructed

    - #### createFOEventHandler

          public FOEventHandler createFOEventHandler(FOUserAgent userAgent,
                                                     String outputFormat,
                                                     OutputStream out)
                                              throws FOPException

      Creates FOEventHandler instances based on the desired output.
      Parameters:
        `userAgent` - the user agent for access to configuration
        `outputFormat` - the MIME type of the output format to use (ex. "application/pdf").
        `out` - the OutputStream where the output is written to (if applicable)
      Returns:
        the newly constructed FOEventHandler
      Throws:
        `FOPException` - if the FOEventHandler cannot be properly constructed

    - #### createDocumentHandler

          public IFDocumentHandler createDocumentHandler(FOUserAgent userAgent,
                                                         String outputFormat)
                                                  throws FOPException

      Creates a `IFDocumentHandler` object based on the desired output format.
      Parameters:
        `userAgent` - the user agent for access to configuration
        `outputFormat` - the MIME type of the output format to use (ex. "application/pdf").
      Returns:
        the new `IFDocumentHandler` instance
      Throws:
        `FOPException` - if the document handler cannot be properly constructed

    - #### listSupportedMimeTypes

          public String[] listSupportedMimeTypes()

      Returns:
        an array of all supported MIME types

Copyright © 2023 Apache Software Foundation. All rights reserved.