PDF Extensions
PHP has several libraries for generating PDF documents. This
chapter shows how to use the popular FPDF library. The FPDF library is a
set of PHP code you include in your scripts with the require function, so it doesn’t require any
server-side configuration or support, meaning you can use it even without
support from your host.
The basic concepts of the structure and features of a PDF file should be common to all the PDF libraries, however. This FPDF library is available here.
Note
There is another PDF-generating library called TCPDF that is
better at handling HTML special characters and UTF-8 multilanguage
output. Look this up if you have that kind of a need. The methods you
will be spending time with will be writeHTMLCell and writeHTML. You can find the library here.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access