Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with pdf reader thread1254-831873

Status
Not open for further replies.

Nifrabar

Programmer
Mar 16, 2003
1,343
NL
Hi

I tried thread thread1254-831873 for getting pdf reader from within vfp
The example throws an error
OLE error code 0x800401f3: Ongeldige klassreeks
(translated from Dutch : Classserial not valid)
error cused by o = CREATEOBJECT("pdfExample")

What's wrong here?
Using XP with VFP9

KR
-Bart
 
The example refers to the class "PDF.PdfCtrl.5". Do you have that Activex on your system? If you go to foxpro and create a form, add a PDF activex, does the class name on the activex show up as PDF.PdfCtrl.5?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
Mike,
this is fullcode. ActiveX needed?

-Bart

Code:
**************************************************
*-- Class Library:  c:\dev\tektip answers\pdfexample.vcx
**************************************************


**************************************************
*-- Class:        pdfexample (c:\dev\tektip answers\pdfexample.vcx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   05/02/04 07:55:10 PM
*-- Example of toggling a pdf control's toolbars
*
LOCAL o
o = CREATEOBJECT("pdfExample")
o.SHOW()
READ EVENTS

*
DEFINE CLASS pdfexample AS FORM


  HEIGHT = 500
  WIDTH = 800
  DOCREATE = .T.
  AUTOCENTER = .T.
  BORDERSTYLE = 2
  CAPTION = "Acrobat Example"
  NAME = "Form1"
  bshowtoolbars = .F.


  ADD OBJECT pdf AS OLECONTROL WITH ;
    OLECLASS = "PDF.PdfCtrl.5", ;
    TOP = 35, ;
    LEFT = 8, ;
    HEIGHT = 457, ;
    WIDTH = 784, ;
    NAME = "pdf"


  ADD OBJECT command1 AS COMMANDBUTTON WITH ;
    AUTOSIZE = .T., ;
    TOP = 5, ;
    LEFT = 106, ;
    HEIGHT = 27, ;
    WIDTH = 112, ;
    CAPTION = "Toggle Tool Bars", ;
    NAME = "Command1"


  ADD OBJECT command2 AS COMMANDBUTTON WITH ;
    TOP = 5, ;
    LEFT = 10, ;
    HEIGHT = 27, ;
    WIDTH = 84, ;
    CAPTION = "Load File", ;
    NAME = "Command2"


  PROCEDURE toggletoolbars
    WITH THIS
      .bShowToolBars = !.bShowToolBars
      .pdf.setShowToolbar(.bShowToolBars)
      .REFRESH()
    ENDWITH
  ENDPROC


  PROCEDURE loadpdf
    LPARAM pdfFile
    WITH THIS
      .pdf.LoadFile(pdfFile)
      .bShowToolBars = .T.
      .REFRESH()
    ENDWITH
  ENDPROC


  PROCEDURE INIT
    THIS.ToggleToolBars()
  ENDPROC

  PROCEDURE DESTROY
    CLEAR EVENTS
  ENDPROC

  PROCEDURE command1.REFRESH
    THIS.CAPTION = "Toggle toolbars "+IIF(THISFORM.bShowToolBars,"off","on")
  ENDPROC


  PROCEDURE command1.CLICK
    THISFORM.ToggleToolBars()
  ENDPROC


  PROCEDURE command2.CLICK
    THISFORM.LoadPdf("C:\Program Files\Adobe\Acrobat 5.0\Help\ENU\MiniReader.pdf")
  ENDPROC


ENDDEFINE
*
*-- EndDefine: pdfexample
**************************************************
 
Yes, take a look at this piece of code:

ADD OBJECT pdf AS OLECONTROL WITH ;
OLECLASS = "PDF.PdfCtrl.5", ;
TOP = 35, ;
LEFT = 8, ;
HEIGHT = 457, ;
WIDTH = 784, ;
NAME = "pdf"

It's adding the ActiveX PDF control to the form.

Tamar
 
Tamar,
oops...
stupid me, overlooked that.
Any idea how to retrieve that ActiveX?
Is freeware ar shareware?
KR
-Bart
 
It comes with Adobe Acrobat Reader (Free), the latest version (v8) is now called 'AcroPDF.PDF.1'. When you look at your activex list that is available to you in VFP, do you see one called Adobe PDF Reader?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
Mike,
'AcroPDF.PDF.1'.OCX
Should be somewhere on my Harddisk than?
KR
-Bart
 
Bart,

Should be somewhere on my Harddisk than?

In general, with ActiveX controls, you don't need to know where they are physically located. Provided they are properly registered, your code will find it.

If you want to be sure that an ActiveX control is installed, open a form in the VFP form designer. Drop an OLE Control onto it. In the resulting Insert Object dialogue, scroll down the Control Types list until you see the control you are interested.

In fact, that would be an alternative way of adding the control to your form, rather than doing it programmatically via ADD OBJECT.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Hi Mike,
I can understand what you mean. But as you can read from this threat this is my first try with this pdf-viewer within VFP and as I need to distribute this app somday I need to include all bits and pieces.
KR
-Bart
 
'AcroPDF.PDF.1'.OCX
Should be somewhere on my Harddisk than?

No, I would doubt that very much. The 'AcroPDF.PDF.1' is the name of the class not the activex. I would do a search on your computer (this may take a longtime) for anything with the "*.ocx" extension.
The problem is, in these type of forums (fora?) that does not allow attachments, the only way to show code samples, is to create a form on our system, put the activex on the form and use the code to show you how it could be done. This does not mean you have this activex on your system, or that version of it.
Like I suggested, go to your activex selection in VFP and find any reference to a PDF activex and put it on a form and look at the name of the class.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top