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

Usefull Functions & Procedures

Free PDF Maker for Visual FoxPro by mgagnon
Posted: 5 Jul 02 (Edited 5 Aug 03)

This information was supplied to me by Bob Lee:
A Free Pdf Maker for VisualFox Pro.

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.  

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.
I
PDF Maker uses GhostScript as its internal processor, don't worry, These simple instructions allow you to install and configure it properly quite quickly.  PDF Maker does NOT make use of Redmon or any other Shareware Products.

First         Get and Configure the Adobe Driver
Download the Generic postscript driver from adobe.com from here.   
http://www.adobe.com/support/downloads/product.jsp?product=pdrv&platform=win#
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).

Second          Install GhostScript
Then install Ghostscript from here. 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

Third            Copy  the VFP PDFMaker Files (http://www.1amsoftware.com/vfpps2pdf/ps2pdf.zip)
Copy the following files from the this Zip to a working directory (some fox project directory )
ps2pdf.prg
ps2pdfdif.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 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.   

The file ps2pdfdir  is a sample utility program designed to show you one way you can convert 100's of ps files in with one command line.  
=ps2pdfdir(ôc:\mypsdirectory\ö)    
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 / modify any of this code.  Its just my part keeping GNU alive.  


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

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