PDFImage pdfImage;
if (image instanceof ImageRawJPEG) {
pdfImage = new ImageRawJPEGAdapter((ImageRawJPEG)image, key);
} else if (image instanceof ImageRawCCITTFax) {
pdfImage = new ImageRawCCITTFaxAdapter((ImageRawCCITTFax)image, key);
} else {
throw new IllegalArgumentException(
"Unsupported Image subclass: " + image.getClass().getName());
}