--- id: fpdf2 version: "2.8.8" license: LGPL-3.0-only license_treatment: copyleft maintenance: active --- # fpdf2 — Simple & fast PDF generation for Python License: copyleft · Maintenance: active · Downloads: 19.1M/mo ## What it is and what it does fpdf2 is a pure-Python PDF generation library that lets you build PDF documents programmatically by adding pages, text, images, tables, and other content. It handles Unicode text with TrueType font embedding, supports internal and external links, can embed images with transparency, and includes features like barcodes, charts, document encryption, and basic HTML conversion. The library depends on Pillow for image handling, fonttools for font subsetting, and defusedxml for safe XML parsing. It's designed to be fast and easy to learn, with a straightforward API: create a FPDF object, add pages, set fonts, write content, and output to a file. The project is mature and actively maintained, supporting Python 3.10 and later. It includes over 1300 unit tests and is widely used in web applications. Use it for: - Generate invoices, receipts, or reports on-the-fly in web applications without external services. - Batch-create templated PDFs (certificates, letters, forms) from data using the templating system. - Embed images, barcodes, or charts into dynamically generated documents. - Convert HTML content to PDF for archival or distribution. - Add document encryption or digital signatures for secure PDF delivery. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. fpdf2 generates PDF documents programmatically in Python, supporting text, images, tables, barcodes, and basic HTML conversion with Unicode font embedding. Yes. fpdf2 is a mature, actively maintained library with low install friction (three lightweight dependencies), no known vulnerabilities, and broad Python version support (3.10+). It's well-suited for straightforward PDF generation tasks. The LGPL-3.0 copyleft license requires that derivative works remain open-source, which is a consideration for proprietary projects but not a barrier for most use cases. ## Install pip install fpdf2 uv add fpdf2 poetry add fpdf2 ## Installing fpdf2 Before you install: Low friction: pure Python with only three runtime dependencies. Actively maintained with a release 5 days ago and 1535 GitHub stars. License in practice: LGPL-3.0-only (copyleft): you may use and modify fpdf2 freely, but derivative works must also be licensed under LGPL-3.0 and source code must be available to users. Quickstart: pip install fpdf2 from fpdf import FPDF pdf = FPDF() pdf.add_page() pdf.set_font('helvetica', size=12) pdf.cell(text="hello world") pdf.output("hello_world.pdf") Verify before relying: - Whether the library's performance characteristics (speed, memory usage) meet your specific document size or throughput requirements. - Whether HTML-to-PDF conversion handles your particular HTML/CSS subset adequately. - Specific use-case compatibility with Django, Flask, FastAPI, or other frameworks mentioned in the description. ## Package facts - License: LGPL-3.0-only (copyleft) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 19.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags python pdf generation library, create pdf from python, pdf writer unicode fonts, generate pdf documents python, pdf creation with tables and images, python pdf with barcodes, lightweight pdf library python, pdf-generation, document-creation [View on SkillFed](https://skillfed.io/packages/fpdf2) · [View on PyPI](https://pypi.org/project/fpdf2/)