Don't use either the HSSF or XSSF classes, but the SS classes. In this case, that means org.apache.poi.ss.usermodel.Workbook instead of HSSFWorkbook or XSSFWorkbook. Then use the code shown at http://poi.apache.org/spreadsheet/quick-guide.html#Images. Additional benefit: your code works with both XLS and XLSX files.
However the link you have provided is at WorkBook level. I needed at XSSFSheet level. Means I needed to get a list of images for a particular XSSFSheet.
Is there any example/code snippet available to extract the images from a XSSFSheet?
Actually yes, I am trying to convert xlsx into pdf and also trying to extract images from xlsx and write into pdf. I am iterating sheet wise and therefore require to extract images sheet wise to write into pdf.