itext 生成PDF文件中加入折线统计图怎么搞啊??
请大家帮助给个例子。谢谢谢谢

解决方案 »

  1.   

    使用jfreechart生成折线统计图,返回统计图的url生成itext的Image:(图在tomcat下的temp目录下,如果其他的服务器,不太清楚)
    String yourImageUrl  = "temp/" +ServletUtilities.saveChartAsPNG(chartBar, 450, 200, null, null);
    Image image5_8 = Image.getInstance(yourImageUrl);
      

  2.   

    最好改成这样下面这样:图是生成在java.io.tmodir这个目录下面的:上面的代码在linux下会出错
    String yourImageUrl = System.getProperty("java.io.tmpdir") + File.separator +  +ServletUtilities.saveChartAsPNG(chartBar, 450, 200, null, null);
    Image image5_8 = Image.getInstance(yourImageUrl);