Text is the heart of a PDF file. As such, there are many options for changing the appearance and layout of text. In this section, we’ll discuss the coordinate system used in PDF documents, functions for inserting text and changing text attributes, and font usage.
(0,0) in a PDF
document with the FPDF library is in the top-left corner of the defined
page. All of the measurements are specified in points, millimeters,
inches, or centimeters. A point (the default) is equal to 1/72 of an
inch, or 0.35 mm. In the code in Example 10-2, we change the
defaults of the page dimensions to inches with the
FPDF() class instantiation-constructor method.
The other options with this call are the orientation of the page
(portrait or landscape) and the page size (typically Legal or Letter).
The full options of this instantiation are shown in Table 10-1.
Table 10-1. FPDF options
FPDF() constructor parameters
Units of measurement
A4 or a customizable size (see FPDF documentation)
Also in Example 10-2, we use the
ln() method call to manage what line
of the page we are on. The
ln() method can take an optional argument instructing it how many units to move (units being the defined unit of measurement in the constructor call). In our case, we have defined the page to be in inches, so we are moving down in inch measurements. Further, ...