Introduction to FPDF

Post on 30-Jul-2015

182 views 1 download

Tags:

transcript

Introduction to FPDFJeremy Curcio

Open West - May 9, 2015

Who Am I?

Software Developer from Baltimore, Maryland

Works for Planit Advertising

Writing iOS Apps since 2008

Hockey Player

Pokémaster

About FPDF

• First released in 2001

• Written by Olivier Plathey

• Completely free to use

• Open Sourced

• Requires no extensions*

• zlib is required to activate compression

• GD is required for GIF support

Where To Get It

• www.fpdf.org/

• Download (ZIP / TAR)

• Tutorials

• Documentation

• User Forum

Abilities

• Automatic page breaks

• Automatic line breaks

• Text justification

• Color management

• Links

• Image support

• Page set up customization

• Set document meta data

• Title

• Author

• Keywords

• Supports many languages

Output

• Can output finished PDF to

• Browser: $pdf->Output(‘invoice.php’, ‘I’);

• Forced Download: $pdf->Output(‘invoice.php’, ‘D’)

• Save to Server: $pdf->Output(‘pdfs/invoice.php’, ‘F’)

Common API Methods

• FPDF

• Constructor method

• FPDF([string orientation [, string unit [. mixed size]]])

• Cell

• Cell(float w [, float h [, string txt [, mixed border [, int ln [, string align [, boolean fill [, mixed link]]]]]]]

More Common API Methods

• Multiline Cell

• MultiCell(float w, float h, string txt[, mixed border [, string align [, boolean fill]]])

• Image

• Image(string file[, float x [, float y [, float w [, float h [, string type [, mixed link]]]]]])

Even More Common API Methods

• Line Break

• Ln([float h])

• Set Font

• SetFont(string family [, string style [, float size]])

• Set XY

• SetXY(float x, float y)

Ready?

Lets Build Something!

Other Capabilities

• Headers and Footers

• Links

• Color

• Add existing documents

Extendability

• Many extensions to FPDF are available

• Bookmark support

• Barcodes

• Circles/Ellipses

• Watermark

• Plus many more

Final Thoughts

• Easy to make

• Highly versatile

• Hugely customizable

Questions?

Resources

Code/Slides available at www.jcurcio.com

joind.in/14056