Article:
  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"));


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.

Full Threads Oldest First

Showing messages 1 through 2 of 2.

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

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

      i have one asp.net page which is succesfully convert in pdf but one problem is thee
      1. image can not convert in pdf
      2. some more spacess in pdf form