My question is how to save an Icon image to a variable in java ? When all the values are displayed from my sql database in the JTextfields, I can write them on a pdf file in Java. However, I retrieve an image from my database which appears on a JLabel. How do I get that image to appear on my pdf file in java? Note that all my details in my JTextfields are shown in the pdf file when it is created. I want this image to appear in my pdf file. http://ift.tt/1CGF5CR
String val8 = id.getText();
Icon val11 = lblimg.getIcon();
try{
Document doc = new Document();
PdfWriter.getInstance(doc, new FileOutputStream("Report.pdf"));
doc.open();
doc.add(new Paragraph("Employee Information",
FontFactory.getFont(FontFactory.TIMES_BOLD,18, Font.BOLD,
BaseColor.RED)));
doc.add(new Paragraph(
"______________________________________________________________________________"));
doc.add(new Paragraph("Employee ID is " + val));
Aucun commentaire:
Enregistrer un commentaire