|
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"));
doc.add(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.
|