【问题标题】:How do you create PDFs using itextsharp and pie charts from live charts?如何使用 itextsharp 和实时图表中的饼图创建 PDF?
【发布时间】:2018-04-17 12:21:27
【问题描述】:

我正在开发一个带有 WPF(MVVM 框架)桌面应用程序的项目。根据需要,我们在项目中集成 LiveCharts 以显示多个图表。现在,根据要求,我必须将多个图像显示为 pdf。如何使用 iTextSharp 生成 pdf?

【问题讨论】:

    标签: c# wpf itext livecharts


    【解决方案1】:

    我自己从 google 和 stackoverflow 找到了答案。 这是代码示例。

    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");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-03-16
      • 1970-01-01
      • 2023-04-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-08
      相关资源
      最近更新 更多