O'Reilly logo

Programming PHP, 3rd Edition by Peter MacIntyre, Kevin Tatroe, Rasmus Lerdorf

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required