Not able to display the blob image dynamicaly from mysql database in itext table

I am trying to display an image from db in the itext table using below code

DAO Class

Blob imageBlob = rs.getBlob("VECHICLE_IMAGE");

byte[] imgData = imageBlob.getBytes(1,(int)imageBlob.length());


Controller Class

PdfPTable nestedTable = new PdfPTable(2);

nestedTable.addCell(new PdfPCell(new Phrase("Image")));

Image image = Image.getInstance(listVechileDetailsReportBean.get(i).getVechileImageByte());


nestedTable.addCell(new PdfPCell(image));

DB Desc

enter code here

[Vechile detail Table][1]

Getting Below error

RegNo:::S234442::Image::com.mysql.cj.jdbc.Blob@22c4fafe The byte array is not a recognized imageformat.

at com.itextpdf.text.Image.getInstance(

at com.itextpdf.text.Image.getInstance(

Kindly suggest me how to display the image in itext from db dynamically...

Read More »

By: StackOverFlow - 5 days ago

Related Posts