473,770 Members | 1,994 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Detect Acrobat Reader

Eleven
19 New Member
Hi,

Got a problem detecting if Acrobat Reader is installed on a machine, would really appreciate your help.

I've got a PDF Report that I export to a directory then open it with Acrobat Reader. I need to check if the PC has Acrobat Reader installed before I open it...

I found this code but it's not working, i always get the messagebox even if the PC has the software installed.

Expand|Select|Wrap|Line Numbers
  1. string RegPath = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
  2.             using (RegistryKey RegKey = Registry.LocalMachine.OpenSubKey(RegPath))
  3.             {
  4.                 foreach (string SW_Name in RegKey.GetSubKeyNames())
  5.                 {
  6.                     if (SW_Name == "Acrobat Reader")
  7.                     {
  8.                         System.Diagnostics.Process.Start(@"C:\\...\\CK1_" + txtEntNo.Text + ".pdf");
  9.                     }
  10.                     else
  11.                     {
  12.                         MessageBox.Show("You do NOT have Acrobat Reader installed on your machine...", "No Acrobat Reader");
  13.                     }
  14.                 }
  15.             } 
  16.  
The only other codes I could find online were JavaScript, i wanna do it in C#. I'm using WinForms!

Thanks!
Jan 15 '09 #1
4 7400
vekipeki
229 Recognized Expert New Member
Open regedit and go to the "HKEY_LOCAL_MAC HINE\SOFTWARE\M icrosoft\Window s\CurrentVersio n\Uninstall\" node. Then press Ctrl+F to search the subnodes for a string (e.g. "reader").

In my registry (I'm using Reader 8.0), it is saved under "{AC76BA86-7AD7-1033-7B44-A81000000003}", so that is what you should detect instead of "Acrobat Reader". Try other versions to see what the GUID looks like.

Other approach would be to go through all nodes in "HKEY_LOCAL_MAC HINE\SOFTWARE\M icrosoft\Window s\CurrentVersio n\Uninstall\" and try to find the one where the DisplayName contains "Adobe Reader".

Additional note: it looks to me like your code is opening a MessageBox many times, once for each element of the loop. Change your code to check all nodes before deciding whether it is installed or not.
Jan 15 '09 #2
Eleven
19 New Member
Thanks a lot Vekipeki!
I just noticed now that my code pops up the message box for each element.. thanks once again, I'll try out your suggestions.
Jan 15 '09 #3
Plater
7,872 Recognized Expert Expert
Couldn't you just run this inside a try/catch block?
System.Diagnost ics.Process.Sta rt(@"C:\\...\\C K1_" + txtEntNo.Text + ".pdf");

If there was no handler for .PDF files, I think it throws an Exception?
Win32Exception: No application is associated with the specified file for this operation.


Might be a better way to do this, since not everyone will use Acrobat to read PDFs(like 99% will, but still)
Jan 15 '09 #4
Eleven
19 New Member
@Plater
Thanks a lot Plater, I actually didn't think about doing it that way! It works perfectly!!!
Jan 16 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

8
12591
by: Chris | last post by:
Hello all, I wish to automate printing of PDF documents in a C# application. Is there an Adobe .net object? I tried to create a reference to the COM Object Adobe Type Library, but I get error "Exception from HRESULT 0x80131019" Thanks Chris
2
3667
by: jimfortune | last post by:
I have modified my GetAcroPath function to: Function GetAcroDir() As String Const LatestVer = 7 Dim strAcroDir(LatestVer - 2) As String Dim I As Integer strAcroDir(1) = "C:\Program Files\Adobe\Acrobat 3.0\Reader\" strAcroDir(2) = "C:\Program Files\Adobe\Acrobat 4.0\Reader\" strAcroDir(3) = "C:\Program Files\Adobe\Acrobat 5.0\Reader\"
2
2290
by: Khan | last post by:
Hi, I'm using acrobat reader contorl in my vb.net application to display pdf files. I'm using version 8.0 of acrobat, but if i run my application on other machine which has different version of acrobat reader (let's say version 5.0) it is giving me an error. If the acrobat version is same on both machines, no error. How can i make it to run on different machines which have different versions of acrobat reader.
5
7462
by: CDMAPoster | last post by:
I have changed how I get the shell path for Acrobat Reader based on code posted by John deKrafft. Does anyone see any problems with this code running on various Windows OS's? '--Begin Module Code 'Support functions and constants for reading a string from the registry 'I have modified the code posted by John deKrafft slightly '---- Declare Function RegQueryValueEx Lib "advapi32.dll" Alias
2
4443
by: =?Utf-8?B?QWxoYW1icmEtRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hello misters, I have a ASPX that contains an IFrame to display a PDF file. Like this: <iframe src="/Files/MyPDF.pdf"></iframe> I have an problem about it, if an user hasn't installed Acrobat Reader Plugin. In that case, the IExplorer shows an popup window with this message:
0
1086
by: vidhyapriya | last post by:
hi i am using Acrobat reader in ASP.Net....in add reference->COM->Acrobat Control for ActiveX....in that pdflib.dll file is added....i cant find any acrobat reader control in toolbax...how to use this acrobat reader in design view.... i need to know to use this in asp.net itself i am using VS2005....Acrobat Reader7.0...
10
10369
by: Mauro | last post by:
I'm trying to use the following VB function to transform a pdf document to a tiff one: http://forums.microsoft.com/msdn/showpost.aspx?postid=1665127&siteid=1&sb=0&d=1&at=7&ft=11&tf=0&pageid=1 Private Sub savePDFtoTIF(ByVal fullPathPDF As String, ByVal fullPathTIF As String) Dim PDFApp As Acrobat.AcroApp Dim PDDoc As Acrobat.CAcroPDDoc Dim AVDoc As Acrobat.CAcroAVDoc Dim JSObj As Object
0
1039
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi misters, I continue installing; my production PC is Windows 2003; development environment: using VS 2005 in Windows XP for create Setup Project Now, I need install Acrobat Reader 7.0 in Windows 2003 using my Setup Project. I have only the redistributable AcrobatReader70setup.exe for Acrobat Reader 7.0. I need create my Setup Project for install AcrobatReader70setup.exe.
0
1820
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi all people, everybody, We have multiple versions of Acrobat Reader from 5.x to 8.x, I want to create a method in C# or VB.NET to check to see if the registry key for the versions exists, and if so uninstall it, then install the latest
0
9618
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10101
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.