{"id":1833,"library":"fpdf","title":"PyFPDF (Original fpdf Library)","description":"PyFPDF is the original Python library for generating PDF documents, ported from the PHP FPDF project. Its last release (1.7.2) was in January 2015, and it is largely unmaintained. While it provides basic PDF creation functionalities like text, images (JPEG, PNG, GIF), and simple layouts, it is generally considered a legacy library. For active development and modern Python compatibility, its successor, fpdf2, is recommended.","status":"abandoned","version":"1.7.2","language":"en","source_language":"en","source_url":"https://github.com/reingart/pyfpdf","tags":["pdf","generation","legacy","unmaintained"],"install":[{"cmd":"pip install fpdf","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Required for GIF image support.","package":"Pillow","optional":true}],"imports":[{"note":"This is the correct import for the 'fpdf' (1.7.2) package. However, the actively maintained successor 'fpdf2' also uses 'from fpdf import FPDF', which can lead to confusion if both are not managed carefully within the same environment or project.","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('Arial', 'B', 16)\npdf.cell(40, 10, 'Hello World!')\npdf.output('hello_world.pdf')","lang":"python","description":"This basic example creates a PDF document named 'hello_world.pdf' with a single page, sets the font to Arial bold 16, and prints 'Hello World!' at the default position."},"warnings":[{"fix":"Migrate to `fpdf2` (`pip install fpdf2`), which is the actively maintained successor designed for modern Python. Be aware of API differences during migration.","message":"The `fpdf` library (version 1.7.2) is largely unmaintained, with its last release in January 2015. It primarily targets Python 2.x and has only experimental support for Python versions up to 3.4. It is not officially supported on modern Python 3.x environments.","severity":"breaking","affected_versions":"All versions of fpdf (including 1.7.2) on Python 3.5+."},{"fix":"Ensure only one of the libraries is installed or manage virtual environments carefully. If using `fpdf2`, verify the import is correctly resolving to the `fpdf2` package.","message":"Both the original `fpdf` (version 1.7.2) and its actively maintained successor `fpdf2` use the same import statement: `from fpdf import FPDF`. This can lead to `ModuleNotFoundError` or unexpected behavior if `fpdf2` is installed but the code expects `fpdf`'s API (or vice-versa).","severity":"gotcha","affected_versions":"All versions of fpdf (1.7.2) and fpdf2."},{"fix":"For applications requiring robust Unicode support, it is strongly recommended to use `fpdf2`, which has comprehensive UTF-8 TrueType font subset embedding.","message":"Native Unicode (UTF-8) support in `fpdf` 1.7.2 is limited and often problematic, especially for non-Latin-1 characters. This can result in garbled text or errors when handling international character sets.","severity":"gotcha","affected_versions":"All versions of fpdf (including 1.7.2)."},{"fix":"Install Pillow: `pip install Pillow`. PNG and JPG formats generally do not require external dependencies.","message":"For GIF image support, the Python Imaging Library (PIL), or its modern fork Pillow, is required. Without it, attempts to use GIF images will fail.","severity":"gotcha","affected_versions":"All versions of fpdf (including 1.7.2)."}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}