Specifications
FIGURE 30.3
score.php presents successful visitors with the option to generate a certificate in one of three ways.
Generating an RTF Certificate
There is nothing to stop us from generating an RTF document by writing ASCII text to a file or
a string variable, but it would mean learning yet another set of syntax.
Here is a very simple RTF document:
{\rtf1
{\fonttbl {\f0 Arial;}{\f1 Times New Roman;}}
\f0\fs28 Heading\par
\f1\fs20 This is an rtf document.\par
}
This document sets up a font table with two fonts: Arial, to be referred to as f0, and Times
New Roman, to be referred to as f1. It then writes Heading using f0 (Arial) in size 28
(14 point). The control
\par indicates a paragraph break. We then write This is an rtf
document
using f1 (Times New Roman) at size 20 (10 point).
We could generate a document like this manually, but there are no labor saving functions built
in to PHP to make the hard parts, such as incorporating graphics, easier. Fortunately, in many
documents, the structure, style, and much of the text are static, and only small parts change
from person to person. A more efficient way to generate a document is using a template.
Building Practical PHP and MySQL Projects
P
ART V
758
36 7842 CH30 3/6/01 3:40 PM Page 758