2017-04-05 177 views
1

我一直在Visual Studio 2012中的ASP.NET MVC應用程序(C#)中工作。我已經創建了多個帶MS圖表的報表(用於在我使用iTextSharp的PDF文件中顯示它們)。要顯示的圖表中iTextSharp的我用下面的代碼的圖像:如何在C#中創建SVG文件並在iTextSharp pdf中導入文件?

using (var chartimage = new MemoryStream()) 
      { 

       chartCentersByYear.SaveImage(chartimage, ChartImageFormat.Png); 

       Byte[] newChart = chartimage.GetBuffer(); 

       var image = Image.GetInstance(newChart); 

       image.ScalePercent(50f); 
       image.SetAbsolutePosition(document.LeftMargin + 40, document.BottomMargin + 95); 

       document.Add(image); 
      } 

但是,我的圖表有一個非常糟糕的質量時,他們在200%縮放。正因爲如此,我想爲圖表使用SVG格式。我怎樣才能在C#中使用iTextSharp? iTextSharp的GetInstance方法無法識別SVG格式。預先感謝您的任何幫助。

回答

1

目前,iText不支持SVG格式。 然而,這是長期路線圖。

+1

謝謝您的回答和興趣。但是,枚舉ChartImageFormat有一個選項:Emf。 GetInstance方法識別字節數組的Wmf格式。你有任何想法如何將Emf流轉換爲Wmf?先謝謝你。 – alenan2016