{"id":1483,"library":"fpdf2","title":"fpdf2","description":"fpdf2 is a simple and fast Python library for generating PDF documents, actively maintained as a modern fork of the original FPDF. It supports a wide range of features including text, images, shapes, tables, and SVG rendering. The current version is 2.8.7, and it has a rapid release cadence with frequent updates adding new features and bug fixes.","status":"active","version":"2.8.7","language":"en","source_language":"en","source_url":"https://github.com/py-pdf/fpdf2","tags":["pdf","document generation","report generation","pdf/a"],"install":[{"cmd":"pip install fpdf2","lang":"bash","label":"Install fpdf2"}],"dependencies":[{"reason":"Optional dependency to improve performance for some internal calculations (e.g., `pack_codes_into_bytes()`).","package":"numpy","optional":true}],"imports":[{"note":"While the package name is `fpdf2`, the main class `FPDF` is imported from the `fpdf` module to maintain compatibility with the original FPDF library API.","wrong":"from fpdf2 import FPDF","symbol":"FPDF","correct":"from fpdf import FPDF"}],"quickstart":{"code":"from fpdf import FPDF\n\npdf = FPDF()\npdf.add_page()\npdf.set_font(\"helvetica\", size=12)\npdf.cell(txt=\"Hello, World!\")\npdf.output(\"hello_world.pdf\")\n","lang":"python","description":"This quickstart code generates a simple PDF document named 'hello_world.pdf' containing the text 'Hello, World!' using the FPDF class."},"warnings":[{"fix":"Upgrade Python to 3.9 or newer. Alternatively, if Python 3.8 must be used, restrict fpdf2 to `<2.8.4` (e.g., `pip install 'fpdf2<2.8.4'`).","message":"fpdf2 dropped support for Python 3.8. Users on Python 3.8 or older must upgrade their Python version to 3.9+ or pin fpdf2 to a version prior to 2.8.4.","severity":"breaking","affected_versions":">=2.8.4"},{"fix":"Always install with `pip install fpdf2` and ensure your code uses `from fpdf import FPDF`. Refer to the official `fpdf2` documentation for current API details.","message":"fpdf2 is a modern, maintained fork of the original `fpdf` library (which had its last release in 2013). New users might accidentally follow outdated tutorials or install the original `fpdf` package, leading to missing features or compatibility issues.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Specify the desired unit in the `FPDF` constructor (e.g., `pdf = FPDF(unit='pt')` or `pdf = FPDF(unit='in')`). All subsequent measurements will use the chosen unit. You can also convert units manually if needed.","message":"The default unit for measurements in FPDF (e.g., `FPDF` constructor, `cell`, `line`) is millimeters (mm). This can be a source of confusion for users accustomed to points (pt) or inches (in).","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}