C# 如何使用itextsharp和实时图表中的饼图创建PDF?
我正在从事一个使用WPF(MVVM框架)桌面应用程序的项目。根据需要,我们在项目中集成LiveCharts以显示多个图表。现在,根据要求,我必须显示成pdf格式的多个图像。如何使用iTextSharp生成pdf 我自己从谷歌和stackoverflow找到了答案。 下面是代码示例C# 如何使用itextsharp和实时图表中的饼图创建PDF?,c#,wpf,itext,livecharts,C#,Wpf,Itext,Livecharts,我正在从事一个使用WPF(MVVM框架)桌面应用程序的项目。根据需要,我们在项目中集成LiveCharts以显示多个图表。现在,根据要求,我必须显示成pdf格式的多个图像。如何使用iTextSharp生成pdf 我自己从谷歌和stackoverflow找到了答案。 下面是代码示例 var DataValue = new LiveCharts.Wpf.PieChart { DisableAnimations = true,
var DataValue = new LiveCharts.Wpf.PieChart
{
DisableAnimations = true,
Width = 600,
Height = 387,
Series = ViewModel.PieCollection
};
var viewbox = new Viewbox();
viewbox.Child = DataValue ;
viewbox.Measure(DataValue .RenderSize);
viewbox.Arrange(new Rect(new System.Windows.Point(0, 0), DataValue .RenderSize));
DataValue .Update(true, true);
viewbox.UpdateLayout();
//Save as image method with chart and name of image
SaveToPng(DataValue, "image.png");