简体   繁体   English

如何从 c# 应用程序中在其本机浏览器中打开资源 pdf 文件?

[英]How to open a resource pdf file in its native browser from within a c# application?

I have a pdf file for example C:\myfile.Pdf我有一个 pdf 文件,例如 C:\myfile.Pdf

Currently I can launch the file from C# code using目前我可以使用 C# 代码启动文件

System.Diagnostics.Process.Start("C:\myfile.pdf") System.Diagnostics.Process.Start("C:\myfile.pdf")

However i will prefer to embed this file as a resource.但是我更喜欢将此文件作为资源嵌入。

How do i accomplish the same result.我如何实现相同的结果。 Process.Start(new ProcessStartInfo(nameof(MyNamespace.Properties.Resources.myfile)));//This will not work Process.Start(new ProcessStartInfo(nameof(MyNamespace.Properties.Resources.myfile)));//这个不行

If I copy the pdf file into the projects Bin\Release folder then I can simply use the same line of code above.如果我将 pdf 文件复制到项目 Bin\Release 文件夹中,那么我可以简单地使用上面的同一行代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用WinRT中的本机应用程序从服务器打开PDF文件? - how to open PDF file from server with native application in winRT? 如何从以管理员身份运行的C#应用​​程序中打开PDF - How to open PDF from C# application running as an administrator 如何使用C#应用程序中的会话信息打开浏览器 - How to open a browser with session information from a C# application 在C#控制台应用程序中的Web浏览器中打开pdf - Open pdf in web browser in C# console application 如何通过Web浏览器控件在新的浏览器选项卡中打开url(显示具有链接的PDF)C# - How to open url in new browser tab from Web browser control (displaying PDF having a link) c# 从C#应用程序制作PDF文件 - Making PDF file from C# application 如何使用iTextSharp生成PDF并从WebApi2 C#/。NET项目中的Web浏览器显示/下载PDF? - How to generate PDF with iTextSharp and show/download it from web browser within a WebApi2 C#/.NET project? 使用c#打开PDF文件 - Open a PDF file with c# 从C#应用程序打开txt文件 - Open txt file from C# application 如何在资源文件C#中打开PowerPoint文件 - How to open PowerPoint file in resource file C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM