Dynamically Creating PDFs in a Web Application
Subject:   Adding an image to an iText pdf
Date:   2006-02-23 08:04:40
From:   rossington
I created a JFreeChart, that I can view with a servlet, and I have saved the image.

ChartUtilities.saveChartAsJPEG(new File("chart.jpg"), jcb.renderChart("time", "", resID), 650, 350);

Image jpg = Image.getInstance(new URL ("http://localhost:8080/myApp/chart.jpg"));


I have verified that the image is at the URL specified. When I render the report, there is no exception, and there is no image in my pdf. I have tried adding the image to a cell and the the cell to a table and then the table to the document, but that does not work.

Best case I would like the to add the JFreeChart directly to the pdf, but I didn't have any luck doing it like this -

BufferedImage bi = jcb.renderChart("time", "", resID).createBufferedImage(650,350);
Image jpg = Image.getInstance(bi, null);

But nothing rendered on my pdf and I didn't get an exception.

1 to 1 of 1
  1. Adding an image to an iText pdf
    2006-10-13 05:38:08  rubenpaxi [View]

    • Adding an image to an iText pdf
      2009-12-19 00:30:57  arshika [View]

1 to 1 of 1