Amass

Client App C#: Opening a PDF in Adobe Reader

January 4th, 2008 Luke

I’m working on a project right now that involves generating PDF reports from a C# client app.

One thing that we thought would be cool is if, after generating the PDF, it was automatically opened in whatever PDF reader the user had on their computer - and as it turns out, there is a simple one-liner that opens the file using whatever application is associated with it on the host machine:

System.Diagnostics.Process.Start(fileName);

Whether you’re passing a PDF, HTML file, or anything else, that call will open it up in the program that the host computer has associated with it.