Sample from documentation works fine, but I need to be able to position chart in pdf. In given example chart is in middle of page and I can change horizontal position but not vertical. In addition when I print table data inside the same pdf it always appears on the before chart if they are on the same page (I need my data to be after the chart).
I would appreciate any help...
Regards
Luke
problem positioning chart when exporting it to pdf
Re: problem positioning chart when exporting it to pdf
I used a technique different from what's in the jfreechart documentation with respect to iText. I used the com.lowagie.text.Image object. That way, you can use the "simple" iText API instead of the "advanced" one:
java.awt.Image awtImage = myJFreeChart.createBufferedImage(width, height);
com.lowagie.text.Image img = com.lowagie.text.Image.getInstance(awtImage, null);
// to make 150dpi (for printing), take 72dpi/150 = 48%
result.scalePercent(48);
Now you should be able to take that image and add it to document objects or table cells in whichever alignment suits you.
Cheers,
Rich
java.awt.Image awtImage = myJFreeChart.createBufferedImage(width, height);
com.lowagie.text.Image img = com.lowagie.text.Image.getInstance(awtImage, null);
// to make 150dpi (for printing), take 72dpi/150 = 48%
result.scalePercent(48);
Now you should be able to take that image and add it to document objects or table cells in whichever alignment suits you.
Cheers,
Rich