A Free Pdf Maker for Visual Fox Pro

Update Version 2 Download click here
My Original Version of the pdf maker is still available below but what I hoped would happen did. Thanks to the work of Paul James and others (Check the source code) this new version has s a complete install, and much better than my original work.
Thank you Paul.

Bob Lee 3/2003

Pdf Maker version 1
PDFMaker
is not just another windows PDF print driver designed to allow you to send anything to it . The difference is this program works from inside Visual Fox Pro to allow you to use all your existing fox reports and put them on your fox web server or produce a paperless solution for printed reports.
A Sample VFP Created and Converted PDF File is here
This program is designed to be run either as a server (with your web server) or sand-alone for desktop usage.
By following these instructions and you should have a PDF Maker, written in pure VFP code in a matter of minutes.
PDF Maker uses GhostScript as its internal processor, but don't worry with these simple instructions you to install and configure it properly quickly. PDF Maker does NOT make use of Redmon or any other Shareware Products. Click Here to to Download PDF Maker

Step 1

Get and Configure the Adobe PS Driver
Download the Generic Postscript Driver from adobe.com from here or below.
http://www.adobe.com/support/downloads/detail.jsp?ftpID=1500

Go to start printers, (or control panels -printers) and select the newly created printer as your default and right-click to properties sheet of the Generic Adobe postscript driver. Select the advanced tab and select new driver. From listing of manufactures select HP and the printer name of HP Color Laser jet 8500 PS.
Then press apply. This creates the color printer driver which in turn creates .ps files (internally converted into PDF files).

Step 2

Install GhostScript
Install Ghostscript from here or . http://www.ghostscript.com/
During installation just use the normal defaults.
If you selected any other non standard place for the location of Ghostscript (meaning anything other than c:\gs\gs7.04\bin\gswin32exe) the edit the file Locationofgs.ini with the correct full path to gswin32.exe
Step 3
Copy the VFP PDFMaker Files
Copy the following files from the this Zip to a working directory (some fox project directory )
Ps2pdf.prg
Ps2pdfdir.prg
locationofgs.ini

Edit your your own .prgs with reports changing 1 line of code and adding a new line, to something like this.

  report form customer_report noconsole to file psfile.ps
=ps2pdf('psfile.ps')

*** or something like this

my_outputfile = 'output.ps'
report form customer_report noconsole to file &my_outputfile
=ps2pdf(my_outputfile)

Once ps2pdf finishes converting and saving a file by name of output.pdf or whatever. Your .PDF is created in a sub directory of the current working directory named pdffiles. You can then in code copy or email the files out. By naming your reports output file name, you know the name of the created PDF File . There is no naming the user has to do.

PS2PDFDIR.PRG

The file ps2pdfdir.prg is a VFP sample utility program designed to show you one way you can convert 100's of ps files in with one command.
=ps2pdfdir("c:\mypsdirectory\")
PS2PDFDIR will convert all of the ps files in that directory – delete them, and place your newly formed pdf files in your pdffile directory

Credits

I 'borrowed' parts of this code from the Microsoft Knowledge Base and hand converted the freely available Unix and Linux ps2pdf command files which basically do the same postscript to PDF conversions using GhostScript for Linux and Unix. The Microsoft borrowed code consisted the parts referencing createprocess().

Feel free to copy or modify any of this code. Its just my part keeping GNU alive.

Bob Lee
WWW.1amsoftware.com
bobl@1amsoftware.com

CopyLeft 2002 Bob Lee WWW.1amsoftware.com