vb.net - Check if Adobe Reader is installed before using it -
i want able have app check if adobe reader installed. if is, want program use display pdf, if not want use free (limited) reader control display pdf.
any suggestions
edit: question seems little broad basicly i'm trying following
try dim acrodisplay new axacropdflib.axacropdf acrodisplay.left = 50 acrodisplay.top = 50 acrodisplay.width = 200 acrodisplay.height = 500 me.controls.add(acrodisplay) msgbox("acro added") catch ex exception msgbox("acro not installed") ''load alternate pdf viewer (spire.pdf free) end try
however when acrobat isn't installed instead of going catch statement shows error "could not load assembly" , exits sub
what want if acrobat control isn't installed, wont display , error , instead load alternate pdf viewer
is there way check axacropdflib.axacropdf before attempting load?
hopefully makes things clearer
edit 2: after searching , screwing around found 2 possible ways might able both can't find how in vb.net
first axacropdflib.axacropdf in available namespaces found c# example don't know how change vb.net c# - how check if namespace, class or method exists in c#??
second add unhandled exception handler found few examples none seem work
any chance direct me working example either (or both) of these options
manged fin working solution, doesn't work how thinking doe work fine
i used following code
dim adobesoftwares microsoft.win32.registrykey = microsoft.win32.registry.localmachine.opensubkey("software").opensubkey("adobe") if adobesoftwares nothing 'messagebox.show("no adobe software") dim pdfdisplay new pdfiumviewer.pdfviewer pdfcontrol = "pdfium" else if not array.indexof(adobesoftwares.getsubkeynames, "acrobat reader") = -1 'messagebox.show("adobe reader installed") dim pdfdisplay new axacropdflib.axacropdf pdfcontrol = "acrobat" else 'messagebox.show("adobe reader not installed") dim pdfdisplay new pdfiumviewer.pdfviewer pdfcontrol = "pdfium" end if end if
then in display code see "pdfcontrol" in use , run relevant code display in display
so if adobe reader installed, i'll using control, , if isn't i'll using free (but less featured) control display pdf files if else looking @ doing similar me can
Comments
Post a Comment