O'Reilly logo

CodeIgniter 2 Cookbook by Rob Foster

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

Creating PDFs with the DOMPDF Spark

The DOMPDF Spark is a great bit of kit; it's simple to set up and can handle most things. It works by grabbing the output of a HTML template file (which you previously created)—you can pass variables to the HTML just as you would with a normal view file—and DOMPDF will create a PDF file from that formatted HTML code.

Getting ready

As this recipe requires the DOMPDF Spark, we'll need to install that into our CodeIgniter instance before we do anything else. To install it, perform the following steps:

  1. Grab the DOMPDF Spark from getsparks.org and install it. Open a terminal window, navigate to your CodeIgniter application directory, and type the following code:
    php tools/spark install dompdf

    That will download the DOMPDF ...

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