code: private void HelperRGB(float red, float green, float blue) {
      	PdfXConformanceImp.checkPDFXConformance(writer, PdfXConformanceImp.PDFXKEY_RGB, null);
          if (red < 0)
              red = 0.0f;
          else if (red > 1.0f)
              red = 1.0f;
          if (green < 0)
              green = 0.0f;
          else if (green > 1.0f)
              green = 1.0f;
          if (blue < 0)
              blue = 0.0f;
          else if (blue > 1.0f)
              blue = 1.0f;
          content.append(red).append(' ').append(green).append(' ').append(blue);
      }
docs: Helper to validate and write the RGB color components
  @param   red     the intensity of red. A value between 0 and 1
  @param   green   the intensity of green. A value between 0 and 1
  @param   blue    the intensity of blue. A value between 0 and 1