Class PNGRenderer

All Implemented Interfaces:
Printable, Constants, Renderer

public class PNGRenderer extends Java2DRenderer
PNG Renderer This class actually does not render itself, instead it extends org.apache.fop.render.java2D.Java2DRenderer and just encode rendering results into PNG format using Batik's image codec
  • Field Details

    • MIME_TYPE

      public static final String MIME_TYPE
      The MIME type for png-Rendering
      See Also:
    • PNG_FILE_EXTENSION

      private static final String PNG_FILE_EXTENSION
      The file extension expected for PNG files
      See Also:
    • firstOutputStream

      private OutputStream firstOutputStream
      The OutputStream for the first Image
    • multiFileUtil

      private MultiFileRenderingUtil multiFileUtil
      Helper class for generating multiple files
  • Constructor Details

    • PNGRenderer

      public PNGRenderer(FOUserAgent userAgent)
      Parameters:
      userAgent - the user agent that contains configuration details. This cannot be null.
  • Method Details

    • getMimeType

      public String getMimeType()
      Get the MIME type of the renderer.
      Returns:
      The MIME type of the renderer, may return null if not applicable.
    • startRenderer

      public void startRenderer(OutputStream outputStream) throws 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.
      Specified by:
      startRenderer in interface Renderer
      Overrides:
      startRenderer in class Java2DRenderer
      Parameters:
      outputStream - The OutputStream to use for output
      Throws:
      IOException - If an I/O error occurs
    • stopRenderer

      public void stopRenderer() throws 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.
      Specified by:
      stopRenderer in interface Renderer
      Overrides:
      stopRenderer in class Java2DRenderer
      Throws:
      IOException - If an I/O error occurs
    • writeImage

      private void writeImage(OutputStream os, RenderedImage image) throws IOException
      Throws:
      IOException
    • getCurrentOutputStream

      protected OutputStream getCurrentOutputStream(int pageNumber) throws IOException
      Returns the OutputStream corresponding to this page
      Parameters:
      pageNumber - 0-based page number
      Returns:
      the corresponding OutputStream
      Throws:
      IOException - In case of an I/O error