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

后端 未结 8 1869
星月不相逢
星月不相逢 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:04

    Check this out easy to open pdf file from resource.

    private void btnHelp_Click(object sender, EventArgs e)
        {            
            String openPDFFile = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\HelpDoc.pdf";//PDF DOc name
            System.IO.File.WriteAllBytes(openPDFFile, global::ProjectName.Properties.Resources.resourcePdfFileName);//the resource automatically creates            
            System.Diagnostics.Process.Start(openPDFFile);             
        }   
    

提交回复
热议问题