<pre><code>$pdf <spanclass="kw">= new </span>FPDF<spanclass="kw">(</span><spanclass="str">'P'</span><spanclass="kw">,</span><spanclass="str">'mm'</span><spanclass="kw">,</span><spanclass="str">'A4'</span><spanclass="kw">);
We can now print a cell with <ahref='../doc/cell.htm'>Cell()</a>. A cell is a rectangular area, possibly framed,
which contains a line of text. It is output at the current position. We specify its dimensions,
its text (centered or aligned), if borders should be drawn, and where the current position
moves after it (to the right, below or to the beginning of the next line). To add a frame, we would do this:
<divclass="source">
<pre><code>$pdf<spanclass="kw">-></span>Cell<spanclass="kw">(</span>40<spanclass="kw">,</span>10<spanclass="kw">,</span><spanclass="str">'Hello World !'</span><spanclass="kw">,</span>1<spanclass="kw">);
</span></code></pre>
</div>
To add a new cell next to it with centered text and go to the next line, we would do:
<divclass="source">
<pre><code>$pdf<spanclass="kw">-></span>Cell<spanclass="kw">(</span>60<spanclass="kw">,</span>10<spanclass="kw">,</span><spanclass="str">'Powered by FPDF.'</span><spanclass="kw">,</span>0<spanclass="kw">,</span>1<spanclass="kw">,</span><spanclass="str">'C'</span><spanclass="kw">);
</span></code></pre>
</div>
Remark: the line break can also be done with <ahref='../doc/ln.htm'>Ln()</a>. This method additionnaly allows to specify
the height of the break.
<br>
<br>
Finally, the document is closed and sent to the browser with <ahref='../doc/output.htm'>Output()</a>. We could have saved
it to a file by passing the desired file name.
<br>
<br>
<strong>Caution:</strong> in case when the PDF is sent to the browser, nothing else must be output by the
script, neither before nor after (no HTML, not even a space or a carriage return). If you send something
before, you will get the error message: "Some data has already been output, can't send PDF file". If you
send something after, the document might not display.