Your SlideShare is downloading. ×
Introduction to FPDF - DC PHP
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Introduction to FPDF - DC PHP


Published on

An introduction to the FPDF Library for PHP. Learn how to create a basic invoice PDF using nothing but code.

An introduction to the FPDF Library for PHP. Learn how to create a basic invoice PDF using nothing but code.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide
  • Family Violence Prevention Fund
  • Free to use in all applications, be they free or commercial, with and without modifications I use FPDF library at work -> Doctors office -> Receipts
  • Frames Download available in ZIP/TAR A handful of tutorials Documentation well written User forum not overly active
  • Arabic based languages, Cyrillic, Greek, Thai, Chinese, Japanese, Korean, also possible to use any TrueType or Type1 font with desired character set
  • Browser Forced Download Server Going to create a simple invoice using static data
  • Portrait/Landscape, PT/MM/CM/IN, A3/A4/A5/Letter/Legal Width-if 0 extend to right margin, height-defaults to 0, txt-string to print, border-0 none (default) 1 frame LTRB sides, ln-where position should go after cell, 0 (default) to right 1 beginning of next line 2 below, align-L (default) C R, fill-cell background to be filled, link-makes cell a link
  • Almost the same as Cell, height is per line, not per multicell except has automatic line breaks file-path/url of image, x-upperleft of image, y-upperright of image, w-width of image, h-height of image, type-image format usually inferred by extension, link-ability to make image a link
  • h-height of break, defaults to height of last cell family-name of font, style-B I U or combination, size-size of font in points default is current size or 12 if not previously set Sets abscissa and ordinate of the current position, where the next cell/image/etc. will be placed. Negative values are from the bottom-right of the page Also available is SetX and SetY if you only have to change one value
  • Going to make an invoice.
  • Create FPDF object Add a page Set meta data Output to browser, with the document name being set to ‘invoice.pdf’
  • Page size Document title Meta data-title, author.
  • Add logo image Set the starting X/Y positions “SetXY” Set font and size “SetFont” Add text “Cell” and “MultiCell”
  • Reset X/Y Adjust font settings Add more text Add line break “Ln”
  • MultiCell supports line explicit line breaks \n
  • Go through the data and create a table from it Last ‘1’ in cell means add border all around
  • Headers and footers can be set to automatically print on each page Links can be added to any text or image Text can be colored If you have a standard pdf of legal text that you attach, you can import that pdf as a new page(s) to your document
  • Many available on, many more just a google search away
  • Less than 100 lines Can be used to create a PDF for any purpose
  • Transcript

    • 1. Introduction to FPDF DC PHP - August 14, 2013 Presented By: Jeremy Curcio Twitter: @Jeremy1026 Web:
    • 2. Sorry
    • 3. About Me • My name is Jeremy Curcio • Born and raised Baltimorean • Or Baltimoron • Working with PHP for about 7 years • Currently employeed with at TapFury
    • 4. About FPDF • First released in 2001 • Written by Olivier Plathey • Completely free to use • Requires no extensions* • zlib is required to activate compression • GD is required for GIF support
    • 5. Overview • • Download (ZIP / TAR) • Tutorials • Documentation • User Forum
    • 6. Abilities • Automatic page breaks • Automatic line breaks • Text justification • Color management • Links • Image support • Page set up customization
    • 7. Outputting Final PDF • 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’)
    • 8. Commonly Used API Methods 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]]]]]]]
    • 9. Commonly Used API Methods 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]]]]]])
    • 10. Commonly Used API Methods API Methods• Line Break • Ln([float h]) • Set Font • SetFont(string family [, string style [, float size]]) • Set XY • SetXY(float x, float y)
    • 11. Creating The PDF
    • 12. Other Capabilities • Headers and Footers • Links • Color • Add existing documents
    • 13. Extendability • Many extensions to FPDF are available • Bookmark support • Barcodes • Circles/Ellipses • Watermark • Plus many more
    • 14. Final Document and Thoughts and Thoughts • Easy to make • Highly versatile • Hugely customizable
    • 15. Questions?
    • 16. Anyone have a printer? so i can get Sandy a hard copy before we leave?
    • 17. Questions?
    • 18. Introduction to FPDF DC PHP - August 14, 2013 Presented By: Jeremy Curcio Twitter: @Jeremy1026 Web: