Package com.pdftools.toolbox.pdf.content
Class ColorSpace
- java.lang.Object
-
- com.pdftools.toolbox.internal.NativeBase
-
- com.pdftools.toolbox.internal.NativeObject
-
- com.pdftools.toolbox.pdf.content.ColorSpace
-
- Direct Known Subclasses:
CalibratedGrayColorSpace
,CalibratedRgbColorSpace
,DeviceCmykColorSpace
,DeviceGrayColorSpace
,DeviceRgbColorSpace
,IccBasedColorSpace
,IndexedColorSpace
,LabColorSpace
,NChannelColorSpace
,SeparationColorSpace
public abstract class ColorSpace extends NativeObject
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ColorSpace
copy(Document targetDocument, ColorSpace colorSpace)
Copy a color spacestatic ColorSpace
createProcessColorSpace(Document targetDocument, ProcessColorSpaceType type)
Get the canonical grayscale, RGB, or CMYK color space.int
getComponentCount()
the number of components in the color space.-
Methods inherited from class com.pdftools.toolbox.internal.NativeObject
equals, hashCode
-
-
-
-
Method Detail
-
createProcessColorSpace
public static ColorSpace createProcessColorSpace(Document targetDocument, ProcessColorSpaceType type) throws java.io.IOException
Get the canonical grayscale, RGB, or CMYK color space.
Depending on the PDF/A compliance and the output intent, this is either a device color space (DeviceGrayColorSpace
,DeviceRgbColorSpace
,DeviceCmykColorSpace
), a calibrated color space (CalibratedGrayColorSpace
,CalibratedRgbColorSpace
), or an ICC-based color space (4-channelIccBasedColorSpace
). The returned color space object is not yet used on any page, but it is associated with the given target document.- Parameters:
targetDocument
- the output document with which the returned object is associatedtype
- the color space type- Returns:
- newly created color space object
- Throws:
java.io.IOException
- Unable to read a required ICC profile or writing to the documentjava.lang.IllegalArgumentException
- if thetargetDocument
argument has already been closedjava.lang.IllegalArgumentException
- if thetargetDocument
argument is read-onlyjava.lang.IllegalArgumentException
- iftargetDocument
isnull
java.lang.IllegalArgumentException
- iftype
isnull
-
copy
public static ColorSpace copy(Document targetDocument, ColorSpace colorSpace) throws java.io.IOException, CorruptException, ConformanceException
Copy a color space
Copy a color space object from an input document to the giventargetDocument
. The returned object is associated with the given target document but not yet part of it.- Parameters:
targetDocument
- the output document with which the returned object is associatedcolorSpace
- a color space of a different document- Returns:
- the copied color space, associated with the current document.
- Throws:
java.io.IOException
- Error reading from the source document or writing to the target documentCorruptException
- The source document is corruptConformanceException
- The conformance level of the source document is not compatible with the conformance level of the target document.java.lang.IllegalArgumentException
- if thetargetDocument
argument has already been closedjava.lang.IllegalArgumentException
- if thetargetDocument
argument is read-onlyjava.lang.IllegalArgumentException
- if thecolorSpace
object is not associated with an input documentjava.lang.IllegalArgumentException
- if thecolorSpace
object has already been closedjava.lang.IllegalArgumentException
- iftargetDocument
isnull
java.lang.IllegalArgumentException
- ifcolorSpace
isnull
-
getComponentCount
public int getComponentCount()
the number of components in the color space. (Getter)
- Throws:
java.lang.IllegalStateException
- if the color space has already been closed
-
-