Integrate PDF Output into FoxFire!

By Todd Stubbert, Foxfire Support

Foxfire! 6.02 includes direct support for PDF but you can add it to existing versions of Foxfire! as well. You simply tap into one of the many existing FFCONFIG phases.  All it takes is a few easy steps:

The first step is to add new styles to FoxFire!’s styles table, FFSTYLEF.  You want to do this so your users can select when they want a request to be outputted to PDF.  You can run the following code directly from the Command Window in VFP.

 

* Create 3 new styles (PDF-Presentation, PDF-Executive, PDF-Ledger)

CD C:\FF60

USE DBFS\FFSTYLEF

SET CARRY ON

GO 1

APPEND

REPLACE STYLE_NAME WITH "PDF-Presentation"

GO 2

APPEND

REPLACE STYLE_NAME WITH "PDF-Executive"

GO 3

APPEND

REPLACE STYLE_NAME WITH “PDF-Ledger”

REPLACE FRX2X WITH "FFRPTHDR.frx", FRX3X WITH "FFRPTHD3.frx",;

LBX2X WITH "FFLBLFMT.LBX", LBX3X WITH "FFLBLFM3.lbx" ;

FOR "PDF" $ STYLE_NAME

USE IN FFSTYLEF

 

Next step is to add the necessary code to FFCONFIG to divert the report output to your PDF printer driver.   In case you aren’t familiar with FFCONFIG, Foxfire! comes with a configuration program called FFCONFIG.PRG. You can control many aspects of Foxfire! using this program. This includes the ability to intercept Foxfire! operations at all key points and to conditionally execute your own code.  See the docs folder for more information on FFCONFIG. 

 

Open FFCONFIG.prg and insert the following into the BEFORE REPORT case.

 

if "PDF" $ m.out_gstyle && PDF style selected

      Do FFPDF.prg with lcRepoCmd, “Adobe”

      llRepoRun = .f.

else

      llRepoRun = .t. && continue with standard outputting

endif

 

From here on you are ready to output your FoxFire! requests into PDF documents.  A couple of things are missing, the PDF printer driver, and the code to run it without having it prompt you for a file name.

 

You might already have your own PDF program ready to go.  If you don’t, here’s three different PDF solutions you can use.  Depending on which one you  choose, you would change the above line of code to send the second parameter as “Adobe”, “Amyuni”, or “Win2pdf” to FFPDF.prg.  You will need to place FFPDF.prg along the FoxFire’s SET PATH.

Download FFPDF here.

 

PDF Printer Drivers

 

Adobe (http://www.adobe.com)

Adobe Acrobat 4.0/5.0

 

In order to work with Adobe, I used Rick Strahl’s free wwPdf class.  You can download a copy at http://www.west-wind.com/Webtools.asp.  Extract the contents of the zip file along your SET PATH for FoxFire!.  You do need the full Adobe Acrobat package in order to use this class.

 

Amyuni Consultants (http://www.amyuni.com/)

PDF Converter Printer Driver

 

To download a demo go to: http://www.amyuni.com/pdfpd.htm#pdfconvdesc.

 

There are some necessary steps involved in setting up the Amyuni PDF Converter Printer Driver before using it with FoxFire!.

 

Once you have the Amyuni PDF Converter Printer Driver installed, go to your printers in the Control Panel, and right-click on Amyuni PDF Converter and select Properties.  On the General tab, click the Printing Preferences button.  You should now see the Amyuni PDF Converter Printing Preferences window.  Select the Destination tab.  Leave the Destination type set to File system.  Since FoxFire! uses the name of your request as an output file, set the Destination file to Document title.pdf, and set leave the Default file name setting blank.  You will want to set your Default directory to your FoxFire! output directory, which in the example above is C:\FF60\Out\.  If you want to overwrite the previous file every time you run the request, set the Overwrite option to Overwrite without asking.

 

Another option that may be of special interest to you is the Preview the PDF File option, which can be found in the Configuration tab.  If you turn this option on, Amyuni will ask you for a PDF reader to automatically launch when printer documents with the PDF Converter printer driver.  This could be any PDF reader, from Amyuni’s own PDF Creator tool, to the free Adobe Acrobat Reader.

 

Dane Prairie Systems LLC (http://www.daneprairie.com/)

Win2PDF

 

You can download a demo of Win2PDF from http://www.daneprairie.com/id43.htm.

 

An important point to remember about Win2PDF is that it does not support Windows 95, 98, ME, or the Macintosh.

 

 

Building PDF Reports with Foxfire!

 

Start FoxFire!, and if you have the Sample Data Set available, select the INVENTRY request.  If you don’t have the Sample Data Set, select any other request you may have.  Edit the request and go into the Output options.

 

Figure 6

 

Specify PDF-Presentation as the Style for the request.  Select Printer has the Send To option.  Click the Send To Options button.  Your default printer will probably not be the PDF Printer Driver, so you will want to click Modify and select the PDF printer driver you have installed, in my sample, Amuyni’s PDF Converter.  Click OK and close the request Options screen.

 

Figure 7

 

Run the request.

Once the output has processed, you should return immediately to the Request Editor window.  You should also find your PDF output file in your OUT folder.

 

Figure 8