Convert the template into an Image with Image.getInstance(PdfTemplate). Best Regards, Paulo Soares
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Gajdos Gabriel > Sent: Monday, March 22, 2004 7:39 AM > To: [EMAIL PROTECTED] > Subject: [iText-questions] Adding JFreeChart to iText without > absolute coordinates > > Hi all! > > I just started to use JFreeChart to be able to add some > charts to iText's > PDFs... > I tried recommended solution but it is not exactly what I want... > > Recommended solution is: > PdfTemplate tp = cb.createTemplate(width, height); > Graphics2D g2 = tp.createGraphics(width, height, mapper); > Rectangle2D rectangle2D = new Rectangle2D.Double(0, 0, width, height); > chart.draw(g2, rectangle2D); //drawing chart > g2.dispose(); > cb.addTemplate(tp, x, y); //adding to absolute coordinates > > With this we can simply write created chart to any absolute > position in PDF. > > But I would like to "add" this chart using the usual way like > f.e. Table or > Paragraph object. > I want the chart to be a consistent (without absolute > coordinates!) part of > text flow in PDF document. > Is it even possible with iText? > > I tried to output chart as JPEG to ByteArrayOutputStream and > later to read > by Jpeg Image in iText. > This Image object was used later in a part of PdfPTable... > It works, but the output is not as nice (bitmapped) as direct > drawing to > Graphics2D. > I am looking for solution similar to following: > : adding Graphics2D to Document in iText, such as "document.add(g2)" > : adding PdfTemplate to document without coordinates (the > template would be > shown in current page or next page if there is not enough > page space), such > as "document.add(template)". > > Thanks for tips. > > Gabriel Gajdos > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > iText-questions mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/itext-questions > > ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions