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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying PDF's In VFP 9 Form Using Adobe Acrobat 9

Status
Not open for further replies.

mdav2

Programmer
Aug 22, 2000
363
GB
Does adobe 9 still provide an active x object that can be used to display pdfs in a VFP form. I used to use the
"AcroPDF.PDF.1" but that doesn't work with acrobat 9.

I've trawled the web and havn't found any code that uses anything later than acrobat 7.

Mark Davies
Warwickshire County Council
 
Mark,

I've found that the most reliable way to do this is to use the Microsft Web Browser control. Provided the user's instance of the Adobe reader is configured to "display in web page", the browser should render the PDF easily and accurately.

A simpler option would be to ShellExecute the PDF, but that will open a separate window outside your application, which is probably not what you want.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
I don't have an answer for your Adobe-specific question.

But while I did not take much time investigating the various 'finds' when I did a Google search for pdf activex a whole host of results were displayed.

While Adobe is the recognized BIG name in the PDF arena, there are a variety of others that work very well (I know because I myself use Foxit for viewing/editing and BullZip as a PDF 'printer').

You might want to consider some of these others.

Good Luck,
JRB-Bldr
 
I found this example works really well:


It uses the same method as Mike described.

Problem I have where we work is adobe is the corporate standard pdf viewer. I don't like the fact its bloatware central (101 meg for a PDF viewer!). I like foxit, nice clean and simple pdf viewer, each to their own though.

Mark Davies
Warwickshire County Council
 
I have not tried this with a PDF, but let me add to Mike's comments concerning using a webbrowser to display the pdf.

Check out the FAQ section - there are some examples to diplay the web browser in a VFP form.

One you might start with is:

Running the web-browser in a VFP form. faq184-4092



Jim
 
Code:
local lcPDF
lcPDF = getfile('PDF')

PUBLIC oForm
oForm = CREATEOBJECT('MyViewer',m.lcPDF)
oForm.Show()

Define Class myViewer As Form
  Height=400
  Width=600
  Add Object htmlViewer As OleControl With ;
    Height=400,Width=600,Anchor=15,OleClass='Shell.Explorer'
  Procedure Init(tcFileName)
    This.htmlViewer.Navigate2('file://'+m.tcFileName)
  Endproc
  Procedure htmlViewer.Refresh()
    Nodefault
  Endproc
Enddefine

Cetin Basoz
MS Foxpro MVP, MCP
 
I took the easy way out and just ran the command through a shell using windows file associations to open with whatever had a PDF extension. Running it inside a form was not crucial to user requirements in the end so dropped it. The code to create the class in the form may come in handy in the future. Thanks guys!

Code:
DECLARE INTEGER ShellExecute IN shell32 INTEGER, STRING @, STRING @, STRING @, STRING @, INTEGER
			= ShellExecute(0, "open", lcfilename, "", "c:\", 1)

Mark Davies
Warwickshire County Council
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top