private PDFCIELabColorSpace getCIELabColorSpace(CIELabColorSpace labCS) { if (this.cieLabColorSpaces == null) { this.cieLabColorSpaces = new java.util.HashMap<String, PDFCIELabColorSpace>(); } float[] wp = labCS.getWhitePoint(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < 3; i++) { if (i > 0) { sb.append(','); } sb.append(wp[i]); } String key = sb.toString(); PDFCIELabColorSpace cielab = this.cieLabColorSpaces.get(key); if (cielab == null) { //color space is not in the PDF, yet float[] wp1 = new float[] {wp[0] / 100f, wp[1] / 100f, wp[2] / 100f}; cielab = new PDFCIELabColorSpace(wp1, null); getDocument().registerObject(cielab); this.resources.addColorSpace(cielab); this.cieLabColorSpaces.put(key, cielab); } return cielab; }