1

How do I retrieve an my image that has been fetched from mysql database and store it in a variable?

The image retrieved from the database is as follows:

byte[] imageData = rs.getBytes("Image");
format = new ImageIcon(imageData);
lblimg.setIcon(format);

Now what I want to do, to store the lblimg into a variable. Then I can use the variable which contains the image to add in a pdf file.

Document doc = new Document();
PdfWriter.getInstance(doc, new FileOutputStream("Report.pdf"));
doc.open();

doc.add(new Paragraph( // img to be added here ));

Please help me to achieve that. Thanks

blackbishop
  • 30,945
  • 11
  • 55
  • 76
yetin
  • 61
  • 11

0 Answers0