Page 1 of 1

Acrobat activex - problems with old Acrobat versions

Posted: Fri Jun 06, 2008 9:09 am
by Marco Turco
Hi to all,
I have a problem using the activex class to open a pdf file because if the Acrobat Reader installed is an old version my app crash.

Is there any way to check the Acrobat Reader version before to call the activex or another way to check if we can use the Acrobat activex in that environment ?

Thanks in advance.

Sample code (from FWH):

function Main()

local oWnd, oActiveX

DEFINE WINDOW oWnd TITLE "FiveWin ActiveX Support"

oActiveX = TActiveX():New( oWnd, "AcroPDF.PDF.1" )
oWnd:oClient = oActiveX // To fill the entire window surface
oActiveX:Do( "LoadFile", "fwintro.pdf" )
oActiveX:Do( "SetCurrentPage", 1 )

ACTIVATE WINDOW oWnd

return nil

Posted: Fri Jun 06, 2008 11:06 am
by MGA
if ! PDFActivex(@arq)
return(.f.)
endif

DEFINE WINDOW oWndpdf MDICHILD OF oWnd vscroll icon oico TITLE ALLTRIM(cFile)
pdfoActiveX = TActiveX():New( oWndpdf, arq )
oWndpdf:oClient = pdfoActiveX
pdfoActiveX:Do( "LoadFile", cFile )
pdfoActiveX:Do( "SetCurrentPage", 1 )
ACTIVATE WINDOW oWndpdf MAXIMIZED valid(oWndpdf:=NIL,pdfoActiveX:end(),.t.)

***********************************
Function PDFActivex(MyProgID)
***********************************
LOCAL adretor:=.T.
if IsActivex( "PDF.PdfCtrl.1" ); MyProgID := "PDF.PdfCtrl.1"; endif
if IsActivex( "PDF.PdfCtrl.2" ); MyProgID := "PDF.PdfCtrl.2"; endif
if IsActivex( "PDF.PdfCtrl.3" ); MyProgID := "PDF.PdfCtrl.3"; endif
if IsActivex( "PDF.PdfCtrl.4" ); MyProgID := "PDF.PdfCtrl.4"; endif
if IsActivex( "PDF.PdfCtrl.5" ); MyProgID := "PDF.PdfCtrl.5"; endif
if IsActivex( "PDF.PdfCtrl.6" ); MyProgID := "PDF.PdfCtrl.6"; endif
if IsActivex( "PDF.PdfCtrl.7" ); MyProgID := "PDF.PdfCtrl.7"; endif
if IsActivex( "acroPDF.PDF.1" ); MyProgID := "acroPDF.PDF.1"; endif
if IsActivex( "acroPDF.PDF.2" ); MyProgID := "acroPDF.PDF.2"; endif
if Empty( MyProgID )
msg( "PDF Activex não instalado !!!"+CRLF+" É necessário que seja instalado o programa ADOBE READER, consulte o suporte do sistema.",.f.)
adretor:=.F.
endif
return(adretor)