}
private void findPictures(List<EscherRecord> records) throws IOException, SAXException, TikaException {
for(EscherRecord escherRecord : records) {
if (escherRecord instanceof EscherBSERecord) {
EscherBlipRecord blip = ((EscherBSERecord) escherRecord).getBlipRecord();
if (blip != null) {
// TODO When we have upgraded POI, we can use this code instead
//HSSFPictureData picture = new HSSFPictureData(blip);
//String mimeType = picture.getMimeType();
//TikaInputStream stream = TikaInputStream.get(picture.getData());
// This code is cut'n'paste from a newer version of POI
String mimeType = "";
switch (blip.getRecordId()) {
case EscherMetafileBlip.RECORD_ID_WMF:
mimeType = "image/x-wmf";
break;
case EscherMetafileBlip.RECORD_ID_EMF:
mimeType = "image/x-emf";
break;
case EscherMetafileBlip.RECORD_ID_PICT:
mimeType = "image/x-pict";
break;
case EscherBitmapBlip.RECORD_ID_PNG:
mimeType = "image/png";
break;
case EscherBitmapBlip.RECORD_ID_JPEG:
mimeType = "image/jpeg";
break;
case EscherBitmapBlip.RECORD_ID_DIB:
mimeType = "image/bmp";
break;
default:
mimeType = "image/unknown";
break;
}
TikaInputStream stream = TikaInputStream.get(blip.getPicturedata());
// Handle the embeded resource
extractor.handleEmbeddedResource(
stream, null, mimeType,
handler, true