Generating PDF Files

Most FoxWeb scripts are programmed to produce HTML output. Well written HTML in conjunction with Cascading Stylesheets (CSS) can provide adequate typographic control in most cases. However, there are situations that may require FoxWeb scripts to produce dynamically-generated PDF output. The Adobe Portable Document Format (PDF) is an open, cross-platform, widely-used standard for electronic information exchange. It provides extremely accurate and flexible typographic controls and, unlike HTML, it supports the embedding of images and other supporting content into the PDF file itself, making it easy for users to download complete documents as a single file.

The easiest way to create PDF files from FoxWeb scripts is to print VFP reports to a PDF printer driver. PDF drivers do not print to an actual printer, but rather create PDF files that can be downloaded over the Web (in reality, most printer drivers used for the purpose of creating PDF files produce Postscript files, which have to be converted to PDF with a separate utility). There are several products that offer PDF printer drivers, including Adobe Acrobat and Ghostscript. PDF creation utilities vary in capabilities, speed, output quality, price and licensing options. Many of these products are simply commercial wrappers to the Ghostscript engine. The GPL version of Ghostscript allows free use, and free copying and redistribution under certain conditions (including, in some cases, commercial distribution). For details please check it's web site. For instructions on how to obtain, install and configure Ghostscript please refer to the Using Ghostscript in FoxWeb document.

Some products, such as Ghostscript, do not "print" directly to PDF files, but rather utilize a PostScript printer driver to create PostScript files, which are then converted to PDF by a separate process. Other products, including Adobe Acrobat, automate the conversion from PostScript to PDF, by having the printer driver automatically call the converter process. Most of these products don't usually work properly with VFP's ability to specify the output file name in the REPORT FORM command line, so they also end up producing PostScript files that need to be converted in a separate step. A small number of products seem to "print" directly to PDF files, so they don't need a separate conversion step. It really doesn't matter whether a separate step is required for conversion from PostScript to PDF, because the amount of processing required for the whole operation is roughly the same and FoxWeb can automate the whole process.

FoxWeb includes the fwPDF object, which can be used in conjunction with PDF utilities to generate PDF files from VFP reports. FwPDF natively supports Adobe Acrobat and Ghostscript, but can also be used with other products that print directly to PDF, or have a command line interface for converting Postscript to PDF.


© Aegis Group