Nassif Bousaba
Nassif Bousaba

Reputation: 396

C# opening PDF file from WPF

I'm creating a pdf file using crystal reports. The report is being successfully exported and created. However, when this is done, I need my WPF application to automatically open the report given the specified path:

string path = svfl.FileName;  <--SaveFileDialog
//somecode here
report.Export();


if (File.Exists(path))
{
    System.Windows.Forms.MessageBox.Show(path);
    File.Open(path, FileMode.Open);
}

The file exists since it goes into the condition, however it does not open. What am i missing?

Upvotes: 1

Views: 1547

Answers (1)

Shadrix
Shadrix

Reputation: 99

Try this:

if (File.Exists(path))
{
    Process.Start(path);
}

Upvotes: 1

Related Questions