title: Error: sun.awt.image.ToolkitImage cannot be cast to java.awt.image.BufferedImage
body: <p>please help me cant do this thing to work to me sun.awt.image.ToolkitImage cannot be cast to java.awt.image.BufferedImage</p>
  
  <pre><code> if (shape.hasImage())
                      {
                          // If this shape is an image, extract image to file
                          String extension = ImageTypeToExtension(shape.getImageData().getImageType());
                          String imageFileName = MessageFormat.format("Image.ExportImages.{0} Out.{1}", imageIndex, extension);
                          String strBarCodeImageExtracted = "" + imageFileName;
                          shape.getImageData().save(strBarCodeImageExtracted);
  
                          // Recognize barcode from this image
                          BarCodeReader reader = new BarCodeReader ((BufferedImage) Toolkit.getDefaultToolkit().getImage(strBarCodeImageExtracted),BarCodeReadType.Code39Standard);
                          while (reader.read())
                          {
                              System.out.println("codetext: " + reader.getCodeText());
                          }
                          imageIndex++;
                      }
  </code></pre>