Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jfreechart itext: put multiple charts in one pdf

How can I put multiple JfreeCharts in to one pdf? There are plenty of examples how to put 1 JfreeChart in to a pdf but I can't find any on how to put multiple JfreeCharts in to 1 pdf.

Some of the JfreeCharts should should go next to each other and others should go below each other.

like image 296
WillamS Avatar asked Dec 05 '25 18:12

WillamS


1 Answers

There's an example in my book: http://itextpdf.com/examples/iia.php?id=262

As you can see, I have two different charts, a pie chart and a bar chart. I draw these charts to a PdfTemplate object. I then add the templates to a canvas using an X,Y coordinate (this allows you to add them next to each other or below each other).

Another option, is to wrap the PdfTemplate objects inside Image objects, and position these images for instance using a PdfPTable.

like image 98
Bruno Lowagie Avatar answered Dec 07 '25 06:12

Bruno Lowagie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!