DMS creates quite a few PDF documents.  Documents are produced in all sections of the website (Common, Events, Resource Area, Shop).


Generation of these PDFs relies on a few external libraries. As of this writing, all the code is free to use.


  • FPDF - a PHP library that include primitives for building a PDF thru calls to functions
    FPDF is documented here.
  • tFPDF - an extension to support UTF8 text (not supported by FPDF directly)
    • tFPDF is documented here
    • it has the same interface as FPDF
    • it includes a font DejaVu that handles many more languages
  • FPDI - an extension to FPDF that supports building a PDF from other PDFs
    • FPDI is documented is here
    • FPFI is layered on either FPDF or tFPDF - our classes use tFPDF
  • FPDI - a library that support passwording PDFs and restricting operations such as copying
    • fpdi-protection can be found in 2 places
      • git hub version that works with FPDI - more here
        This is the version used we use since we are currently protecting existing PDF files not created by DMS.  Note that this version currently does NOT support tFPDF
      • FPDF version found here


These external libraries are the common/third_party directory.

  • directory fpdf contains the current implementation of FPDF and tFPDF
  • directory fpdi contains FPDI
  • directory fpdiprotection contains the FPDI version of FPDI-Protection


The Utility area of the Resource Area (admin=>access utilities) has 2 buttons for testing this directory setup:

  • Test PDF Creation will test the simple creation of a pdf, use the UFT8 fonts, and embed one PDF in another
  • Test PDF IEncryption will test FPDI-Protection


Much of the generation of PDFs is layered in CodeIgniter libraries that interface with these external libraries.  PDF, PDF_FDI, and PDFUtilites are the base classes that the nested libraries extend.  Each library adds methods that are helpful to its purpose.


  • PDF - base class for our PDFs
    • PDFBill - creates bills
    • PDFCertificate - create award certificates
    • PDFComplexListing - creates one or more tables interspersed with text
    • PDFLabel - creates a variety of PDF sticky labels
    • PDFReport - handles a number of reports
    • PDFTables - creates a table in a pdf
    • PDFTeamLabel
  • PDF_FPDI - supports including one PDF in another and general PDF writing like PDF
    • PDFScoreSheet - creates scoresheets and lists of score sheets
    • PDFSign - creates sign and notes
  • PDFUtilities
    • supports protecting PDFs


The constructor for all of these CodeIgniter libraries classes take an array as an argument that initialize the PDF being generated.  All support the FPDF arguments:

  • orientation: P for portrait and L for landscape (default is portrait)
  • unit: pt for points, mm for millimeters, cm for centermeters, inch for inches (default is mm)
  • size: Letter,A3,A4,A5,Legal (default is A4)


The PDF and PDF_FPDI classes add:

  • isUTF8: 1 will load UTF8 fonts
  • fontFamily: sets a default font - Arial is the default
  • printFooter: whether to put a footer on the page