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!

VFP printing/previewing PDF Files 2

Status
Not open for further replies.

ARS1

Programmer
Joined
Aug 8, 2002
Messages
40
Location
US
Is there a way to build an app in VFP that will allow a user to preview and/or print PDF files?
 
Use the Shellexecute api.

Rather than repeating myself - take a look my responses on the the following forum. It will work for your pdf files too. You can pass in a parameter stating whether you wish to print or open the file.

I use this method for lots of stuff including lauching pdf, notepad, web urls, etc.

Hyperlink to a file
thread184-243825

Jim Osieczonek
Delta Business Group, LLC
 
Dave Summers,
Once I plot the Adobe viewer control (.ocx) on a form what are the commands to print or preview the PDF's? I can't find any documentatio.
Thanks
 
Jim,
Your code works like a dream! At this point I'm trying to get educated about using the activex control.
Thanks again!
 
The reason I ask, is I try to avoid active x control if I can find a way to do it in native vfp language. The problems I have with controls is distributing them to users.

I work with different clients, different environment, and different rights. Sometimes the control registers fine (install shield or regsvr32) and sometimes it does not. When it does not - I end up spending an excessive amount time trying to debug why.

Therefore, I have just learned to live without them unless I absolutely have to. Others may have had better luck.

Additionally, if you develop for a single company, and have more control over the environment – this may not be as big as issue.




Jim Osieczonek
Delta Business Group, LLC
 
When you run the form, you somehow need to get the pdf into the control.
To do that, you can use a 'Get PDF' command button with this line of code in it:
Code:
Thisform.oPDFcontrol1.loadFile(GETFILE('pdf'))

At that time, all the PDF viewer controls will be available:
Print, Zoom, Previous, Next, etc.

You can still code these things using commands like:
Code:
ThisForm.oPDFcontrol1.Print
ThisForm.oPDFcontrol1.PrintPages(1,2)  &&... print page 1 & 2
ThisForm.oPDFcontrol1.PrintAll

ThisForm.oPDFcontrol1.gotoPreviousPage
ThisForm.oPDFcontrol1.gotoNextPage

And so on. But since they're already there, why bother.

If you want to see all the rest (from VFP 7 or greater), Intellisense works great from within the command window.



-Dave Summers-
[cheers]
Even more Fox stuff at:
 
PDF Printing....

When using an install pdfWriter print driver a report will print the desired pdf file but somehow the program path gets changed and my executing vfp application can no longer find it's databases. Why is the path changing and how can I prevent that?

Thanks for any help.
 
I am not sure how you are creating your file. If you are specifying the path, that should not occur. If you are picking it with a picker, that is a common behavior (e.g. gefile function, etc.).


Anyway, to trap for it do this:

* Save original
lcDefault = SET('default')
lcpath = SET('path')

* DO WHATEVER

* Reset
SET DEFAULT TO (lcDefault)
SET PATH TO (lcPath)

Jim Osieczonek
Delta Business Group, LLC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top