private void SaveFile(string filter) { //To Represent SaveFile Dialog Box SaveFileDialog m_SaveFileDialog = new SaveFileDialog(); //Assign the selected extension to the SavefileDialog filter m_SaveFileDialog.Filter = filter; //To display savefiledialog bool?istrue = m_SaveFileDialog.ShowDialog(); string filenamechanged; if (istrue == true) { //assign the filename to a local variable string extension = System.IO.Path.GetExtension(m_SaveFileDialog.FileName).TrimStart('.'); string fileName = m_SaveFileDialog.FileName; if (extension != "") { if (extension.ToLower() != ExportType.ToLower()) { fileName = fileName + "." + ExportType.ToLower(); } if (ExportType.ToLower() == "pdf") { filenamechanged = fileName + ".xps"; ExportSettings.IsSaveToXps = true; //Assigning exportstream from the saved file this.ExportSettings.FileName = filenamechanged; // Method to Export the SfDiagram (this.Info as IGraphInfo).Export(); var converter = new XPSToPdfConverter { }; var document = new PdfDocument(); document = converter.Convert(filenamechanged); document.Save(fileName); document.Close(true); } else { if (ExportType.ToLower() == "xps") { ExportSettings.IsSaveToXps = true; } //Assigning exportstream from the saved file this.ExportSettings.FileName = fileName; // Method to Export the SfDiagram (this.Info as IGraphInfo).Export(); } } } }