if (image.getRawData() != null){
bytes = image.getRawData();
put(PdfName.LENGTH, new PdfNumber(bytes.length));
return;
}
streamBytes = new ByteArrayOutputStream();
transferBytes(is, streamBytes, -1);
break;
case Image.JPEG2000:
put(PdfName.FILTER, PdfName.JPXDECODE);
if (image.getColorspace() > 0) {
switch(image.getColorspace()) {
case 1:
put(PdfName.COLORSPACE, PdfName.DEVICEGRAY);
break;
case 3:
put(PdfName.COLORSPACE, PdfName.DEVICERGB);
break;
default:
put(PdfName.COLORSPACE, PdfName.DEVICECMYK);
}
put(PdfName.BITSPERCOMPONENT, new PdfNumber(image.getBpc()));
}
if (image.getRawData() != null){
bytes = image.getRawData();
put(PdfName.LENGTH, new PdfNumber(bytes.length));
return;
}
streamBytes = new ByteArrayOutputStream();
transferBytes(is, streamBytes, -1);
break;
default:
throw new BadPdfFormatException(errorID + " is an unknown Image format.");
}