Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Export a Chart to PDF

The following example demonstrates how to export the chart data as a PDF document to a file.

using System.Diagnostics;
using System.IO;
using System.Windows;
using DevExpress.Xpf.Charts;

namespace ExportToPdf {

    public partial class MainWindow : Window {
        string PDFFile = "Output.pdf";
        public MainWindow() {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e) {
            PrintSizeMode sizeMode = PrintSizeMode.Stretch;
            chartControl.ExportToPdf(PDFFile, sizeMode);
            Process.Start(PDFFile);
        }
    }
}