|
The tutorials using images AND jfreechart are lacking
because they assume you can place the image on the page at a given X,Y
coordinate. Most real world layouts will not allow for this, and the graphs
should be done “within” the document flow. This is achievable by the following: /* inject code as you will */ ByteArrayOutputStream bos = new
ByteArrayOutputStream(); ChartUtilities.writeChartAsJPEG(
bos, chart, 400, 300 ); Toolkit tk =
Toolkit.getDefaultToolkit(); java.awt.Image img = tk.createImage(
bos.toByteArray() ); /* we now have a valid image object */ /* later on in your code */ Paragraph p = new Paragraph(); com.lowagie.text.Image itextImg =
com.lowagie.text.Image.getInstance( img, offsetX, offsetY ); p.add( itextImg ); document.add( p ); /* the image should now appear amid the document flow
properly without having to resort to X,Y hardcoding */ == Stanton |
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
