org.apache.fop.render

## Interface Renderer

- All Known Implementing Classes:
    AbstractPathOrientedRenderer, AbstractRenderer, AbstractXMLRenderer, AWTRenderer, IFRenderer, Java2DRenderer, PageableRenderer, PNGRenderer, PrintRenderer, PrintRenderer, TIFFRenderer, TXTRenderer, XMLRenderer

      public interface Renderer

  Interface implemented by all renderers. This interface is used to control the rendering of pages and to let block and inline level areas call the appropriate method to render themselves.

  A Renderer implementation takes areas/spaces and produces output in some format.

  Typically, most renderers are subclassed from FOP's abstract implementations (`AbstractRenderer`, `PrintRenderer`) which already handle a lot of things letting you concentrate on the details of the output format.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `ROLE` Role constant for Avalon.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Graphics2DAdapter` | `getGraphics2DAdapter()`
    `ImageAdapter` | `getImageAdapter()`
    `java.lang.String` | `getMimeType()` Get the MIME type of the renderer.
    `FOUserAgent` | `getUserAgent()` Returns the associated user agent.
    `void` | `preparePage(PageViewport page)` This is called if the renderer supports out of order rendering.
    `void` | `processOffDocumentItem(OffDocumentItem odi)` Tells the renderer to process an item not explicitly placed on the document (e.g., PDF bookmarks).
    `void` | `renderPage(PageViewport page)` Tells the renderer to render a particular page.
    `void` | `setDocumentLocale(java.util.Locale locale)`
    `void` | `setupFontInfo(FontInfo fontInfo)` Set up the given FontInfo.
    `void` | `startPageSequence(LineArea seqTitle)` Deprecated. Use `startPageSequence(PageSequence)` instead
    `void` | `startPageSequence(PageSequence pageSequence)` Tells the renderer that a new page sequence starts.
    `void` | `startRenderer(java.io.OutputStream outputStream)` Initiates the rendering phase.
    `void` | `stopRenderer()` Signals the end of the rendering phase.
    `boolean` | `supportsOutOfOrder()` Reports if out of order rendering is supported.

- - ### Field Detail

    - #### ROLE

          static final java.lang.String ROLE

      Role constant for Avalon.

  - ### Method Detail

    - #### getMimeType

          java.lang.String getMimeType()

      Get the MIME type of the renderer.
      Returns:
        The MIME type of the renderer, may return null if not applicable.

    - #### startRenderer

          void startRenderer(java.io.OutputStream outputStream)
                             throws java.io.IOException

      Initiates the rendering phase. This must only be called once for a rendering. If stopRenderer is called then this may be called again for a new document rendering.
      Parameters:
        `outputStream` - The OutputStream to use for output
      Throws:
        `java.io.IOException` - If an I/O error occurs

    - #### stopRenderer

          void stopRenderer()
                            throws java.io.IOException

      Signals the end of the rendering phase. The renderer should reset to an initial state and dispose of any resources for the completed rendering.
      Throws:
        `java.io.IOException` - If an I/O error occurs

    - #### getUserAgent

          FOUserAgent getUserAgent()

      Returns the associated user agent.
      Returns:
        the user agent

    - #### setupFontInfo

          void setupFontInfo(FontInfo fontInfo)
                             throws FOPException

      Set up the given FontInfo.
      Parameters:
        `fontInfo` - The font information
      Throws:
        `FOPException` - if an error occurs while setting up the font info object

    - #### supportsOutOfOrder

          boolean supportsOutOfOrder()

      Reports if out of order rendering is supported.

      Normally, all pages of a document are rendered in their natural order (page 1, page 2, page 3 etc.). Some output formats (such as PDF) allow pages to be output in random order. This is helpful to reduce resource strain on the system because a page that cannot be fully resolved doesn't block subsequent pages that are already fully resolved.

      Returns:
        True if this renderer supports out of order rendering.

    - #### setDocumentLocale

          void setDocumentLocale(java.util.Locale locale)

      Parameters:
        `locale` - Locale of the language

    - #### processOffDocumentItem

          void processOffDocumentItem(OffDocumentItem odi)

      Tells the renderer to process an item not explicitly placed on the document (e.g., PDF bookmarks). Note - not all renderers will process all off-document items.
      Parameters:
        `odi` - The off-document item to be rendered

    - #### getGraphics2DAdapter

          Graphics2DAdapter getGraphics2DAdapter()

      Returns:
        the adapter for painting Java2D images (or null if not supported)

    - #### getImageAdapter

          ImageAdapter getImageAdapter()

      Returns:
        the adapter for painting RenderedImages (or null if not supported)

    - #### preparePage

          void preparePage(PageViewport page)

      This is called if the renderer supports out of order rendering. The renderer should prepare the page so that a page further on in the set of pages can be rendered. The body of the page should not be rendered. The page will be rendered at a later time by the call to `renderPage(PageViewport)`.
      Parameters:
        `page` - The page viewport to use

    - #### startPageSequence

          void startPageSequence(LineArea seqTitle)

      Deprecated. Use `startPageSequence(PageSequence)` instead
      Tells the renderer that a new page sequence starts.
      Parameters:
        `seqTitle` - The title of the page sequence

    - #### startPageSequence

          void startPageSequence(PageSequence pageSequence)

      Tells the renderer that a new page sequence starts.
      Parameters:
        `pageSequence` - the page sequence

    - #### renderPage

          void renderPage(PageViewport page)
                          throws java.io.IOException,
                                 FOPException

      Tells the renderer to render a particular page. A renderer typically responds by packing up the current page and writing it immediately to the output device.
      Parameters:
        `page` - The page to be rendered
      Throws:
        `java.io.IOException` - if an I/O error occurs
        `FOPException` - if a FOP interal error occurs.

Copyright 1999-2019 The Apache Software Foundation. All Rights Reserved.