Title: position of a chart

Hello,

I want to use itext for generate pdf files containing charts generated with JFreeReport. That�s no problem. I used an example from the JFreeReport documentation and extended it with paragraphs etc.

The result is a pdf with tables and paragraphs and a chart. But my problem is to place the chart for example under a paragraph. In the JFreeReport documentation following code is used

                PdfContentByte cb = writer.getDirectContent();

                PdfTemplate tp = cb.createTemplate(width, height);

                Graphics2D g2 = tp.createGraphics(width, height, mapper);

                Rectangle2D r2D = new Rectangle2D.Double(0, 0, width, height);

                chart.draw(g2, r2D);

                g2.dispose();

                       

                cb.addTemplate(tp,0,0);

Because of "cb.addTemplate(tp,0,0);" the chart is positioned at 0,0.

But I want to position the chart for example under the last paragraph or table I added before. How could I do it???

With kind regards

Michael


Reply via email to