PDFColorHandler (Apache FOP Core 2.11 API)
Date: 2025-04-24

org.apache.fop.pdf

## Class PDFColorHandler

- java.lang.Object
- - org.apache.fop.pdf.PDFColorHandler

-     public class PDFColorHandler
      extends Object

  This class handles the registration of color spaces and the generation of PDF code to select the right colors given a `Color` instance.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PDFColorHandler(PDFResources resources, PDFResourceContext resourceContext)` Create a new instance for the given `PDFResources`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `establishColor(StringBuffer codeBuffer, Color color, boolean fill, boolean alpha)` Generates code to select the given color and handles the registration of color spaces in PDF where necessary.

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

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

- - ### Constructor Detail

    - #### PDFColorHandler

          public PDFColorHandler(PDFResources resources,
                                 PDFResourceContext resourceContext)

      Create a new instance for the given `PDFResources`
      Parameters:
        `resources` - the PDF resources

  - ### Method Detail

    - #### establishColor

          public void establishColor(StringBuffer codeBuffer,
                                     Color color,
                                     boolean fill,
                                     boolean alpha)

      Generates code to select the given color and handles the registration of color spaces in PDF where necessary.
      Parameters:
        `codeBuffer` - the target buffer to receive the color selection code
        `color` - the color
        `fill` - true for fill color, false for stroke color

Copyright © 2025 Apache Software Foundation. All rights reserved.