Example usage for org.apache.pdfbox.pdmodel.graphics.color PDColor getColorSpace

List of usage examples for org.apache.pdfbox.pdmodel.graphics.color PDColor getColorSpace

Introduction

In this page you can find the example usage for org.apache.pdfbox.pdmodel.graphics.color PDColor getColorSpace.

Prototype

public PDColorSpace getColorSpace() 

Source Link

Document

Returns the color space in which this color value is defined.

Usage

From source file:org.fit.pdfdom.PDFBoxTree.java

License:Open Source License

/**
 * Creates a CSS rgb specification from a PDF color
 * @param pdcolor/* w  w w. j av a2  s  . co m*/
 * @return the rgb() string
 */
protected String colorString(PDColor pdcolor) {
    String color = null;
    try {
        float[] rgb = pdcolor.getColorSpace().toRGB(pdcolor.getComponents());
        color = colorString(rgb[0], rgb[1], rgb[2]);
    } catch (IOException e) {
        log.error("colorString: IOException: {}", e.getMessage());
    }
    return color;
}