Acrobat activex - problems with old Acrobat versions

Post Reply
User avatar
Marco Turco
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London
Contact:

Acrobat activex - problems with old Acrobat versions

Post 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
Best Regards,

Marco Turco
SOFTWARE XP LLP
MGA
Posts: 1219
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá
Contact:

Post 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)
ubiratanmga@gmail.com

FWH17.04
FWPPC
Harbour/xHarbour
xMate
Pelles´C
TDolphin
Post Reply