* the list of error to update if the validation fails.
* @return true if the color space is valid, false otherwise.
*/
protected boolean processDeviceNColorSpace(PDColorSpace pdcs,
List<ValidationError> result) {
PDDeviceN deviceN = (PDDeviceN) pdcs;
try {
if (iccpw == null) {
result.add(new ValidationError(
ERROR_GRAPHIC_INVALID_COLOR_SPACE_MISSING, "DestOutputProfile is missing"));
return false;
}
PDColorSpace altColor = deviceN.getAlternateColorSpace();
boolean res = true;
if (altColor != null) {
res = processAllColorSpace(altColor, result);
}
int numberOfColorants = 0;
PDDeviceNAttributes attr = deviceN.getAttributes();
if (attr != null) {
Map colorants = attr.getColorants();
if (colorants != null) {
numberOfColorants = colorants.size();
for (Object col : colorants.values()) {
if (col != null) {
res = res && processAllColorSpace((PDColorSpace) col, result);
}
}
}
}
int numberOfComponents = deviceN.getNumberOfComponents();
if (numberOfColorants > MAX_DEVICE_N_LIMIT || numberOfComponents > MAX_DEVICE_N_LIMIT ) {
result.add(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_TOO_MANY_COMPONENTS_DEVICEN, "DeviceN has too many tint components or colorants"));
res = false;
}
return res;