2013-07-30 123 views
0

我正在研究我公司的商業智能,但是當我將我的圖表導出爲PDF時,它是空的,沒有顯示PDF上的值。我搜索了關於此平臺上的問題,但是我的問題沒有解決。 Lets Suppose i want to export this graph on Pdf but when i export it on PDF it not ![out put like this no graph and values shows 顯示圖表以及數值我也上傳PDF圖像] 1 這是我的代碼。MS Chart導出爲PDF

btnExportPDF_Click(object sender, EventArgs e) 
{ 
    Document Doc = new Document(PageSize.A4, 10f, 10f, 10f, 0f); 

    PdfWriter.GetInstance(Doc, Response.OutputStream); 

    Doc.Open(); 

    using (MemoryStream memoryStream = new MemoryStream()) 
    { 

     Chart1.SaveImage(memoryStream, ChartImageFormat.Png); 

     iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(memoryStream.GetBuffer()); 

     img.ScalePercent(75f); 

     Doc.Add(img); 

     Doc.Close(); 

     Response.ContentType = "application/pdf"; 

     Response.AddHeader("content-disposition", "attachment;filename=XYZ_BI Chart.pdf"); 

     Response.Cache.SetCacheability(HttpCacheability.NoCache); 

     Response.Write(Doc); 

     Response.End(); 

    } 
} 
+0

沒有人能夠回答其中的所有冠軍 – Raheel

回答

-1

安裝一個CutePDF打印機,這樣當您打印文檔時,它將創建一個PDF圖表,無需編碼。印刷

示例代碼(VB.NET)

MyFooChart.Printing.Print(True)