检查是否有安装任何类型的PDF阅读器的 [英] Check if there is any kind of PDF Reader installed

查看:218
本文介绍了检查是否有安装任何类型的PDF阅读器的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在应用程序帮助函数,即由一个 WebBrowser控件。这 WebBrowser控件被充满 .pdf文件,来源为 .pdf文件是我们自己的网站。

I have a Help function in my Application, that consists of one webbrowser control. That webbrowser control gets filled with a .pdf file, the source for that .pdf file is our own website.

现在的问题是,不是每个人都会有一个 PDF阅读器安装在他们的机器上,所以我想查一个人是否已安装:是或否。我在网上搜索,我主要是看到#2的用户希望在哪里检查 ADOBE READER 安装,这不是我想要的。我需要知道,如果有一个 PDF阅读器在机器上的某个地方安装。

The problem is, that not everyone will have a PDF Reader installed on their machine, so I want to check whether one is installed: Yes or No. I searched the internet and I mostly saw that users on Stackoverflow where wanting to check if Adobe Reader was installed, that is not what I want. I need to know IF there is a PDF Reader somewhere installed on the machine.

我发现下面的代码,都不可能帮助我:

I did find the following code, that can possibly help me:

public void CheckPdfReaderAvailable()      
{      
    RegistryKey key = Registry.ClassesRoot.OpenSubKey(".pdf");      
    Assert.IsNotNull(key);      
}  



我看着上面的代码,我的想法是,代码检查在注册不知道 PDF格式,但我'不知道。

As I look at the above code, my thoughts are that the code checks if the registry does know the .pdf format, but I'am not sure.

有人能告诉我如何使用上面的代码,或提供给我一个例子,约我应该怎么拿下这个问题提前?

Can somebody tell me how to use the code above or provide me an example, about how I should take down this problem?

谢谢!

编辑:

以下的答案必须帮我出:的 http://stackoverflow.com/a/774482/1661209

The following answer helped my out: http://stackoverflow.com/a/774482/1661209

另一个的方式来解决这个问题,是一个PDF阅读器精简版增加的先决条件,使用户安装,首先,你不必检查一个PDF阅读器,因为你知道一个是安装的话,如果它不是你可以说这是他们无法使用帮助功能,因为你为他们提供了一种方法来安装PDF阅读器很容易地使用公布的项目的用户的错误。

Another way to solve this problem, is to add a pdf reader lite to the prerequisites and make the users install that first, you don't have to check for a pdf Reader, because you know one is installed then, if it isn't you could say it is the mistake of the user that they can't use the help function, because you offered them a way to install the pdf reader easily using the published project.

推荐答案

除了它是否有用知道或没有,你可以很可能检查以下注册表项:

Apart from whether it is useful to know or not, you could probable check the following registry key:

HKEY_CLASSES_ROOT\MIME\Database\Content Type\application / PDF

这将有一个条目 CLSID ,它指向的默认应用程序的类ID。

This will have an entry CLSID, which points to the class ID of the default application.

如果注册表项或 CLSID 值不存在,那么MIME类型是未知的,或者没有默认的应用程序来处理MIME类型应用程序/ PDF 文件。

If the registry key or CLSID value is not present, then the MIME type is unknown, or there is no default application to handle the MIME type application/pdf files.

这篇关于检查是否有安装任何类型的PDF阅读器的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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