How to open a PDF file that is also a project resource?

后端 未结 8 1866
星月不相逢
星月不相逢 2021-01-17 19:35

I have a PDF file that I have imported in as a resource into my project. The file is a help document so I want to be able to include it with every deployment. I want to be a

8条回答
  •  说谎
    说谎 (楼主)
    2021-01-17 20:03

    //create a temporal file
    string file = Path.GetTempFileName() + ".pdf";
    //write to file
    File.WriteAllBytes(file, Properties.Resources.PDF_DOCUMENT);
    //open with default viewer
    System.Diagnostics.Process.Start(file);
    

提交回复
热议问题