//Зберігає графік в форматі pdf private void pdfToolStripMenuItem_Click(object sender, EventArgs e) { //if there is no graph drawn show error message if ((Graph.graphList != null) && (!Graph.graphList.Any())) { string message = rm.GetString("NoGraph"); string title = rm.GetString("Error"); MessageBox.Show(message, title); } else { SaveFileDialog saveFile = new SaveFileDialog(); string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); //desktop path saveFile.InitialDirectory = desktop; saveFile.Filter = "Pdf Files(*.pdf) |*.pdf;"; saveFile.Title = rm.GetString("SaveImg"); saveFile.FileName = "graph"; saveFile.AddExtension = true; saveFile.DefaultExt = "pdf"; saveFile.FilterIndex = 2; saveFile.RestoreDirectory = true; if (saveFile.ShowDialog() == DialogResult.OK) { var pdfExporter = new PdfExporter { Width = 600, Height = 400, Background = OxyColors.White }; pdfExporter.ExportToFile(myModel, saveFile.FileName); } } }
private void SavePdf_Click(object sender, RoutedEventArgs e) { PdfExporter x = new PdfExporter() { Width = 700, Height = 400 }; var dialog = new SaveFileDialog() { Filter = "Potable Document Files (*.pdf)|*.pdf;" }; if (dialog.ShowDialog() == true) { x.ExportToFile(StatModel, dialog.FileName); } }