Hey there,
I am struggeling getting the PDDeviceN color space to work. I am trying
to create a simple page with one rectangle having a color defined
against a DeviceN space. I tried the following:
PDDeviceN cs =newPDDeviceN();
cs.setAlternateColorSpace(PDDeviceCMYK.INSTANCE);
cs.setColorantNames(Arrays.asList("Cyan","Magenta","Yellow","Black","Orange","Green"));
PDFunction func;
COSArray domains =newCOSArray();
COSArray ranges =newCOSArray();
domains.setFloatArray(new
float[]{0.0f,1.0f,0.0f,1.0f,0.0f,1.0f,0.0f,1.0f,0.0f,1.0f,0.0f,1.0f});
ranges.setFloatArray(new float[]{0.0f,1.0f,0.0f,1.0f,0.0f,1.0f,0.0f,1.0f});
COSDictionary dict=newCOSDictionary();
dict.setItem(COSName.FUNCTION_TYPE, COSInteger.get(4));
dict.setItem(COSName.DOMAIN, domains);
dict.setItem(COSName.RANGE, ranges);
try{
func = PDFunction.create(tintdata);
cs.setTintTransform(func);
}catch(IOException e) {
e.printStackTrace();
}
This results in a NullPointerError in the first row of the try-part. The
type4-function should just pop the first two values (to get from CMYKOG
to CMYK). Could someone give me a jump start on how to define a
PDDeviceN space?
Have a nice day,
Floris