I have a JFreeChart that is successfully being put into a Document. I now
need to add text after the chart in some circumstances. I tried adding a
paragraph after writing out the chart but the text appears behind the
chart at the top of the page. How can I get the text to show up after
the chart?
// step 2:
// we create a writer
docWriter = PdfWriter.getInstance(doc, baosPDF);
// step 3: we open the document
doc.addAuthor(ReportUtility.REPORT_SOURCE);
doc.addCreationDate();
doc.addProducer();
doc.addCreator(ReportUtility.REPORT_SOURCE);
doc.addTitle(this.title);
addFooter();
doc.open();
PdfContentByte cb = docWriter.getDirectContent();
PdfTemplate tp = cb.createTemplate(this.width,
this.height);
Graphics2D g2 = tp.createGraphics(width, height,
new DefaultFontMapper());
Rectangle2D r2D = new Rectangle2D.Double(0, 0,
width, height);
chart.draw(g2, r2D, null);
g2.dispose();
cb.addTemplate(tp, 50, 150);
// add a footnote if needed
if (this.hasLookthrough) {
Font footnoteFont = new Font();
footnoteFont.setStyle(fontStyle);
footnoteFont.setSize(8);
doc.add(new Paragraph(LOOKTHROUGH_FOOTNOTE
, footnoteFont));
}
Kimberly Greuling
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php