1
當我添加1個圖表文件是沒有問題的問題添加圖表(JFreeChart的PDF)和(iText的)
當我添加第二張圖我得到這個錯誤...螺紋
異常「main」com.itextpdf.text.exceptions.IllegalPdfSyntaxException:不平衡的保存/恢復狀態操作符。
chart1 = SpecialJFreeChartBuilder.createChart1(
"Site and Number of Requests ", results);
document.newPage();
PdfContentByte Add_Chart_Content = writer.getDirectContent();
PdfTemplate template_Chart_Holder = Add_Chart_Content
.createTemplate(width, height);
Graphics2D Graphics_Chart = template_Chart_Holder.createGraphics(
width, height, new DefaultFontMapper());
Rectangle2D Chart_Region = new Rectangle2D.Double(0, 0, 540, 380);
chart1.draw(Graphics_Chart, Chart_Region);
Graphics_Chart.dispose();
Add_Chart_Content.addTemplate(template_Chart_Holder, 0, 0);
chart2 = SpecialJFreeChartBuilder.createChart2(
"Site and totalAmount ", results);
document.newPage();
PdfContentByte Add_Chart_Content1 = writer.getDirectContent();
PdfTemplate template_Chart_Holder1 = Add_Chart_Content1
.createTemplate(width, height);
Graphics2D Graphics_Chart1 = template_Chart_Holder1.createGraphics(
width, height, new DefaultFontMapper());
Rectangle2D Chart_Region1 = new Rectangle2D.Double(0, 0, 540, 380);
chart2.draw(Graphics_Chart1, Chart_Region1);
Graphics_Chart.dispose();
Add_Chart_Content.addTemplate(template_Chart_Holder1, 0, 0);
.... document.close();
誰能幫我....
解決了問題... Graphics_Chart.dispose(); 必須是: Graphics_Chart1.dispose(); Graphics_Chart2.dispose(); – 2011-05-27 22:04:52