C# How to open a PDF in my project resources?

c#, pdf

Solution

string locationToSavePdf = Path.Combine(Path.GetTempPath(), "file name for your pdf file.pdf");  // select other location if you want
File.WriteAllBytes(locationToSavePdf,Properties.Resources.nameOfFile);    // write the file from the resources to the location you want
Process.Start(locationToSavePdf);    // run the file

Problem

I have a WinForms GUI that has a 'help' context menu. When clicked, I would like to open the user manual for the application. The manual is a pdf which is stored within the application resources. Question: How do I open this for the user? Code I'm working with ``` System.Diagnostics.Process process = new System.Diagnostics.Process(); bool adobeInstall = false; RegistryKey adobe = Registry.LocalMachine.OpenSubKey("Software").OpenSubKey("Adobe"); if (adobe != null) { RegistryKey acroRead = adobe.OpenSubKey("Acrobat Reader"); if (acroRead != null) adobeInstall = true; } if (adobeInstall == true) { ///Open the pdf file?? } ```

Original source