Class PDFICCBasedColorSpace

    • Constructor Detail

      • PDFICCBasedColorSpace

        public PDFICCBasedColorSpace​(java.lang.String explicitName,
                                     PDFICCStream iccStream)
        Constructs a the ICCBased color space with an explicit name (ex. "DefaultRGB").
        Parameters:
        explicitName - an explicit name or null if a name should be generated
        iccStream - the ICC stream to associate with this color space
      • PDFICCBasedColorSpace

        public PDFICCBasedColorSpace​(PDFICCStream iccStream)
        Constructs a the ICCBased color space.
        Parameters:
        iccStream - the ICC stream to associate with this color space
    • Method Detail

      • getICCStream

        public PDFICCStream getICCStream()
        Returns:
        the ICC stream associated with this color space
      • getNumComponents

        public int getNumComponents()
        Get the number of color components for this colorspace
        Specified by:
        getNumComponents in interface PDFColorSpace
        Returns:
        the number of components
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface PDFColorSpace
        Returns:
        the name of the color space
      • isDeviceColorSpace

        public boolean isDeviceColorSpace()
        Specified by:
        isDeviceColorSpace in interface PDFColorSpace
        Returns:
        true if the color space is a device-dependent color space (like DeviceRGB, DeviceCMYK and DeviceGray)
      • isRGBColorSpace

        public boolean isRGBColorSpace()
        Specified by:
        isRGBColorSpace in interface PDFColorSpace
        Returns:
        true if the color space is an RGB color space
      • isCMYKColorSpace

        public boolean isCMYKColorSpace()
        Specified by:
        isCMYKColorSpace in interface PDFColorSpace
        Returns:
        true if the color space is an CMYK color space
      • isGrayColorSpace

        public boolean isGrayColorSpace()
        Specified by:
        isGrayColorSpace in interface PDFColorSpace
        Returns:
        true if the color space is an Gray color space
      • toPDFString

        protected java.lang.String toPDFString()
        This method returns a String representation of the PDF object. The result is normally converted/encoded to a byte array by toPDF(). Only use this method to implement the serialization if the object can be fully represented as text. If the PDF representation of the object contains binary content use toPDF() or output(OutputStream) instead. This applies to any object potentially containing a string object because string object are encrypted and therefore need to be binary.
        Overrides:
        toPDFString in class PDFObject
        Returns:
        String the String representation
      • setupsRGBAsDefaultRGBColorSpace

        public static PDFICCBasedColorSpace setupsRGBAsDefaultRGBColorSpace​(PDFDocument pdfDoc)
        Sets sRGB as the DefaultRGB color space in the PDF document.
        Parameters:
        pdfDoc - the PDF document
        Returns:
        the newly installed color space object
      • setupsRGBColorSpace

        public static PDFICCBasedColorSpace setupsRGBColorSpace​(PDFDocument pdfDoc)
        Installs the sRGB color space in the PDF document.
        Parameters:
        pdfDoc - the PDF document
        Returns:
        the newly installed color space object
      • setupsRGBColorProfile

        public static PDFICCStream setupsRGBColorProfile​(PDFDocument pdfDoc)
        Sets up the sRGB color profile in the PDF document. It does so by trying to install a very small ICC profile (~4KB) instead of the very big one (~140KB) the Sun JVM uses.
        Parameters:
        pdfDoc - the PDF document
        Returns:
        the ICC stream with the sRGB profile