kaable wrote: > hi to all > > i new in itext, so how i can add more than one chart (from JFreeChart) with > iText,
See chapter 14 of the second edition of "iText in Action". This is the result of listing 14.13 and 14.14: http://www.flickr.com/photos/itextinaction/4484123858/ > i have this code and for everytime i have one more chart i call this > function Where did you find that code? > public void chartToPdf(JFreeChart chart){ > try{ > document.open(); > PdfContentByte cb = writer.getDirectContent(); > PdfTemplate tp = cb.createTemplate(width, height); > Graphics2D g2d = tp.createGraphics(width, height, new > DefaultFontMapper()); > > Rectangle2D r2d = new > Rectangle2D.Double(x,y,width,height); > chart.draw(g2d, r2d); > g2d.dispose(); > cb.addTemplate(tp, x, y); > > document.newPage(); > writer.setPageEmpty(false); > document.close(); > > }catch(Exception e){ e.printStackTrace();} > } > > but in the end it doesnt write in the file? The code isn't complete enough to create a PDF file; but it has too many lines if you want to use it as a method to add a chart to a PDF in a larger program. As you are new to iText, you will certainly benefit from http://itextpdf.com/book/ -- This answer is provided by 1T3XT BVBA http://www.1t3xt.com/ - http://www.1t3xt.info ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
