通过Windows应用程序打开PDF文件 [英] Open PDF file through windows application

查看:185
本文介绍了通过Windows应用程序打开PDF文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在创建Windows应用程序,我想通过编码打开并阅读PDF文件。在浏览按钮上单击我选择要打开的pdf文件,那么使用哪个控件?请回复。

Hi I am creating windows application in which i want to open and read PDF file through coding.On browse button click i select the pdf file to open,so which control is used for this? reply please.

推荐答案

查看这篇文章:

如何在C#中显示pdf文件 [ ^ ]

也可以看到:

关于在c#中打开pdf文件 [ ^ ]
Check this article :
How to Show pdf file in C#[^]
Also can see :
about opening a pdf file in c#[^]


非嵌入式解决方案(即不是放入您自己的UI的控件)是让Windows运行PDF文件,这将使用用户的默认PDF应用程序处理程序打开PDF文件(类似于用户会发生的情况)在PDF文件上双击以打开它)。



这样做的好处是用户可以选择用于PDF的应用程序(通过将其首选的PDF应用程序设置为打开的默认应用程序) PDF文件)并且还意味着您的应用程序将不再直接依赖于Adobe Acrobat Reader。



A non-embedded solution (i.e. not a control put into your own UI) is get Windows to "run" the PDF file, which will open the PDF file with the user's default PDF application handler (similar to what would happen had the user "double-clicked" on the PDF file to open it).

The benefit of doing it this way is that the user can choose what application to use for PDFs (by setting their preferred PDF-capable application as the default for opening a PDF file) and also means that your application will no longer depend directly on Adobe Acrobat Reader.

// Code snippet...
string pdfFilePath= "C:\MyLocation\My.pdf";

var start = System.Diagnostics.Process.Start(pdfFilePath);
start.EnableRaisingEvents = true;
start.Exited += delegate (object sender, EventArgs e)
{
    // You can even do something when the PDF application closes
}





当然,这取决于您是否可以将要求更改为不需要在应用程序中嵌入PDF查看控件。



Of course this depends on whether you can change your requirements to not require embedding a PDF viewing control within your application.


这篇关于通过Windows应用程序打开PDF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆