You can do this using Process.Start :
System.Diagnostics.Process.Start(@"C:\myfolder\document.pdf");
If the file is an embedded resource, you first need to extract it and save it to disk. You cannot open a document from the stream directly, because third-party applications will not be able to access the memory of your process:
string resourceName = "test.pdf"; string filename = Path.Combine(Path.GetTempPath(), resourceName); Assembly asm = typeof(Program).Assembly; using (Stream stream = asm.GetManifestResourceStream( asm.GetName().Name + "." + resourceName)) { using (Stream output = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.Write)) { byte[] buffer = new byte[32 * 1024]; int read; while ((read = stream.Read(buffer, 0, buffer.Length)) > 0) { output.Write(buffer, 0, read); } } } Process.Start(filename);
source share