On 15-Nov-04 Richard Lewis wrote:
Hello ALUG,
I'm just working on adding a PDF 'data sheet' function to one of my databases. (Served using PHP and the FPDF class http://www.fpdf.org/). At the moment it doesn't work because it can't find any fonts (even with names like "Times") and, of course, the obvious answer is to install some.
The Debian package for FPDF suggests installing 'ttf2pt1'. This package depends on a whole load (~20MB, OK not that much) of packages from X which I'm slightly reluctant to install because the machine is supposed to be a web/database server, not an X server. It doesn't, of course, need an X server and maybe (suggestions?) I'm being silly by not wanting to install 'xfree86-common', 'xlibs', etc. (I just don't like the idea of X clutter everywhere).
So, can anyone suggest a way of installing a nice selection of fonts without any X packages or will someone reassure me that installing X packages (not server) is not something to worry about? ;-)
Hi Richard, I'm not familiar with either getting PDF out of PHP nor with the 'ttf2pt1' package.
The "ttf" suggests that these are "truetype" fonts, which your fpdf URL suggests should work.
Personally I'm something of a diehard "Type 1" type. These are also handled by FPDF, it seems.
There are a lot of Type 1 PostScript fonts supplied with ghostscript. However, while the ".afm" (font metrics) files are there (which you will need for FPDF), the ghostscript font definition files seem to be ".pfa" and not ".pfb" (".pfb" files are binary encodings of ".pfa" files); according to the FPDF web site, it looks as though FPDF may want to see ".pfb" rather than ".pfa". However, it could be that ".pfa" might work.
If you go to your URL
and then click on "tutorials" in "The tutorials will give you a quick start", and then "Tutorial 7", you will find a talk-through on installing fonts whose ".afm" and ".pfb" files are present on the machine. Actually you can go straight there with
http://www.fpdf.org/en/tutorial/tuto7.htm
It may be possible to be a lot more helpful if one knew what you intended to do with PDF in your application.
If you want to create PDF files from data in a database, it can be convenient to use groff; this can be very straightforward. If your PDF files are going to be viewed in Acrobat Reader, and you're only going to use the "Standard Adobe Set", then strictly speaking you don't need to have font definition files installed: all you need are the metrics and the encodings. Groff uses the ".pfa" versions.
Software like groff only looks at encodings and metrics, and Reader has the font def files built in so it will display the PDF files correctly provided you're only using "Standard Adobe". Of course, if you're going outside this set then you must have the font def files as well, which will be encapsulated in the PDF document so that Reader knows how to render them.
Maybe you could mail me privately an example of the sort of thing you want to achieve, and I could think about it in a more focused fashion.
Best wishes, Ted.
-------------------------------------------------------------------- E-Mail: (Ted Harding) Ted.Harding@nessie.mcc.ac.uk Fax-to-email: +44 (0)870 094 0861 [NB: New number!] Date: 15-Nov-04 Time: 17:17:03 ------------------------------ XFMail ------------------------------