INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Forms & Screen

A quick form to show your PDF files within VFP. by ramani
Posted: 6 Oct 03 (Edited 6 Oct 03)

1. If you pass a pdf file name with path as parameters, the form will show the file without a file selection choice. If no parameters snt, the button will be auto displayed to choose a PDF file.
2. Cut and paste the following to a prg.. say..
gsPDF.prg
And RUN it from command window or call it from another prg..
=gsPDF()  or  =gsPDF("cPdfFileName")
**********************************************************
** Form to display PDF files.
**********************************************************
** Author      : Ramani (Subramanian.G)
**               FoxAcc Software / Winners Software
** Type        : Freeware with reservation to Copyrights
** Warranty    : Nothing implied or explicit
**********************************************************
** I used PDF reader ver 6.0.
** Should work with earlier versions also
** If necessary change suitably in the line ...
**    ADD OBJECT olecontrol1 AS olecontrol WITH ;
**      OLEClass = "PDF.PdfCtrl.5"
**********************************************************
PARAMETERS tFile

PUBLIC oform1

oform1=NEWOBJECT("form1")

IF VARTYPE(cFile) # "U"
   oForm1.cmdFile.Visible = .f.   
   oForm1.cmdExit.Visible = .f.   
   oForm1.oleControl1.Top = 12
   oForm1.oleControl1.LoadFile([&cFile])
ENDIF

oform1.Show
RETURN
**********************************************************
DEFINE CLASS form1 AS form

   DoCreate = .T.
   Caption = "pdfForm"
   Name = "Form1"

   ADD OBJECT cmdfile AS commandbutton WITH ;
      Top = 12, ;
      Left = 12, ;
      Height = 27, ;
      Width = 144, ;
      Caption = "Select File", ;
      Name = "cmdFile"

   ADD OBJECT cmdexit AS commandbutton WITH ;
      Top = 12, ;
      Left = 168, ;
      Height = 27, ;
      Width = 84, ;
      Caption = "E\<xit", ;
      Name = "cmdExit"

   ADD OBJECT olecontrol1 AS olecontrol WITH ;
      OLEClass = "PDF.PdfCtrl.5", ;
      Top = 48, ;
      Left = 12, ;
      Height = 192, ;
      Width = 348, ;
      Name = "Olecontrol1"

   PROCEDURE Init
      ThisForm.ReSize()
   ENDPROC

   PROCEDURE Resize
      ThisForm.Olecontrol1.Height = ThisForm.Height - 60
      ThisForm.Olecontrol1.Width = ThisForm.Width - 24
      ThisForm.Olecontrol1.Refresh()
   ENDPROC

   PROCEDURE cmdfile.Click
      LOCAL cFile
      cFile = GETFILE([PDF])
      IF !EMPTY(cFile)
         THISFORM.oleControl1.LoadFile([&cFile])
      ENDIF
   ENDPROC

   PROCEDURE cmdexit.Click
      ThisForm.Release()
   ENDPROC

ENDDEFINE
**********************************************************
** EOF
**********************************************************

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close