You can draw the chart to a template and use that template as an image, there's a constructor in Image for that.
Paulo ----- Original Message ----- From: "Stanton Fisque" <[EMAIL PROTECTED]> To: "Post all your questions about iText here" <[email protected]> Sent: Wednesday, September 06, 2006 9:39 PM Subject: Re: [iText-questions] real world image injection > My apologies, I copied the wrong method when posting this. The Image > construction should be as follows: > > > > com.lowagie.text.Image itextImg = com.lowagie.text.Image.getInstance( img, > transColor ); > > > > _____ > > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Stanton > Fisque > Sent: Wednesday, September 06, 2006 1:33 PM > To: [email protected] > Subject: [iText-questions] real world image injection > > > > 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 > ------------------------------------------------------------------------- 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
