FPDF
Generate PDF files in pure PHP with no external dependencies
Repository Health
Technical Analysis
FPDF is a PHP class that allows you to generate PDF files with pure PHP. The ‘F’ in FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs, with no licensing cost and no dependency on external libraries such as PDFlib.
Despite being a compact, single-class library, FPDF provides a complete set of primitives for laying out documents: page management, TrueType/Type1 font support, images, colors, links, and automatic page breaks. Its long track record and simplicity have made it one of the most widely used PDF generation tools in the PHP ecosystem.
What You Get
- A single self-contained FPDF class with no third-party PHP dependencies
- Page, font, color, and image primitives for building documents by hand
- Cell and multi-cell helpers for text layout, alignment, and tables
- Automatic page breaks plus overridable Header() and Footer() hooks
Common Use Cases
- Generating invoices, receipts, and reports from application data
- Producing printable documents such as tickets, certificates, and labels
- Serving as the rendering base for higher-level PDF libraries and extensions
Under The Hood
Architecture - The entire library is a single procedural-style class in fpdf.php that builds the PDF byte stream directly. Internal buffers accumulate page content, object definitions, and font metrics; methods like AddPage, SetFont, Cell, Image, and Output write low-level PDF operators and assemble the cross-reference table when the document is emitted. Fonts are described by metric files under the font directory, and makefont scripts convert TrueType/Type1 fonts into that format.
Tech Stack - Pure PHP with only the zlib (compression) and GD (image handling) extensions required. Distributed via Composer using a classmap autoload of the single fpdf.php file; there are no runtime PHP package dependencies.
Code Quality - The code is old-school and terse, using a single large class with short method names rather than modern OOP decomposition or namespaces. It carries no automated test suite in the repository, which mirrors upstream FPDF releases, but its long production history and stability compensate; documentation lives as tutorials and an FAQ shipped alongside the code.
API Design - The imperative, coordinate-based API is small and easy to learn: instantiate FPDF, AddPage, SetFont, and place content with Cell/MultiCell. Extensive tutorials on fpdf.org lower the barrier to entry, though building complex layouts requires manual positioning and the API predates fluent/modern PHP conventions.
Used by 2 apps in this directory
Invoice Ninja
Invoicing Finance · Project Management
Self-hostable invoicing, time-tracking, and multi-gateway payment platform for freelancers and small businesses, with built-in e-invoicing compliance for EU and global standards.
OpnForm
Forms Surveys · Marketing
Build unlimited, embeddable forms with no code — powered by AI, logic rules, and real-time analytics