---
title: "fpdf2 | pypx"
description: "Simple & fast PDF generation for Python"
canonical_url: "https://pypx.app/packages/fpdf2"
meta:
  "og:description": "Simple & fast PDF generation for Python"
  "og:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_fpdf2%2Cversion_2.9.0%2Csummary_~U2ltcGxlICYgZmFzdCBQREYgZ2VuZXJhdGlvbiBmb3IgUHl0aG9u%2Clicense_LGPL-3.0-only%2Cp_Ii9wYWNrYWdlcy9mcGRmMiI%2Cs__WyrHRF8cBsKNlq6.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "fpdf2 2.9.0"
  "twitter:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_fpdf2%2Cversion_2.9.0%2Csummary_~U2ltcGxlICYgZmFzdCBQREYgZ2VuZXJhdGlvbiBmb3IgUHl0aG9u%2Clicense_LGPL-3.0-only%2Cp_Ii9wYWNrYWdlcy9mcGRmMiI%2Cs__WyrHRF8cBsKNlq6.png"
---

> Index of every page on this site: [llms.txt](https://pypx.app/llms.txt)

# **fpdf2**

v2.9.0

Simple & fast PDF generation for Python

352 KB Python 3.11+ py3-none-anyLGPL-3.0-only2 deps

[** Diff **](https://pypx.app/packages/fpdf2/diff)

`$ uv add fpdf2`

[![Pypi latest version](https://img.shields.io/pypi/v/fpdf2.svg)](https://pypi.org/pypi/fpdf2#history) [![Python Support](https://img.shields.io/pypi/pyversions/fpdf2.svg)](https://pypi.org/project/fpdf2/) [![License: LGPL v3](https://img.shields.io/badge/License-LGPL%20v3-blue.svg)](https://www.gnu.org/licenses/lgpl-3.0)

[![build status](https://github.com/py-pdf/fpdf2/workflows/build/badge.svg)](https://github.com/py-pdf/fpdf2/actions?query=branch%3Amaster) [![codecov](https://codecov.io/gh/py-pdf/fpdf2/branch/master/graph/badge.svg)](https://codecov.io/gh/py-pdf/fpdf2) [![Pypi Trusted Publisher: enabled](https://img.shields.io/badge/Pypi%20Trusted%20Publisher-enabled-green.svg)](https://blog.pypi.org/posts/2023-04-20-introducing-trusted-publishers/) [![checks: bandit, grype, guarddog, pylint, semgrep, zizmor](https://img.shields.io/badge/checks-bandit,grype,guarddog,pylint,semgrep-green.svg)](https://github.com/py-pdf/fpdf2/actions/workflows/continuous-integration-workflow.yml)

[![Dependents](https://img.shields.io/librariesio/dependents/pypi/fpdf2)](https://libraries.io/pypi/fpdf2/dependents) [![Downloads per month](https://pepy.tech/badge/fpdf2/month)](https://pepy.tech/project/fpdf2) [![Contributors](https://img.shields.io/github/contributors/py-pdf/fpdf2)](https://github.com/py-pdf/fpdf2/graphs/contributors) [![GitHub last commit](https://img.shields.io/github/last-commit/py-pdf/fpdf2)](https://github.com/py-pdf/fpdf2/commits/master)

[![issues closed](https://img.shields.io/github/issues-closed/py-pdf/fpdf2)](https://github.com/py-pdf/fpdf2/issues) [![PRs closed](https://img.shields.io/github/issues-pr-closed/py-pdf/fpdf2)](https://github.com/py-pdf/fpdf2/pulls) [![Pull Requests Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](https://makeapullrequest.com) [![first-timers-only Friendly](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://www.firsttimersonly.com/) → come look at our [good first issues](https://github.com/py-pdf/fpdf2/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)

# fpdf2

![fpdf2 logo](https://py-pdf.github.io/fpdf2/fpdf2-logo.png)

`fpdf2` is a PDF creation library for Python:

```
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")
```

Go try it **now** online in a Jupyter notebook: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/py-pdf/fpdf2/blob/master/tutorial/notebook.ipynb) or [![Open In nbviewer](https://img.shields.io/badge/Open_In-nbviewer-blue?logo=jupyter)](https://nbviewer.org/github/py-pdf/fpdf2/blob/master/tutorial/notebook.ipynb)

Compared with other PDF libraries, `fpdf2` is **fast, versatile, easy to learn and to extend** ([example](https://github.com/digidigital/Extensions-and-Scripts-for-pyFPDF-fpdf2)). It is also entirely written in Python and has very few dependencies: [Pillow](https://pillow.readthedocs.io/en/stable/) & [fontTools](https://fonttools.readthedocs.io/en/latest/index.html). It is a fork and the successor of `PyFPDF` (*cf.* [history](https://py-pdf.github.io/fpdf2/History.html)).

**Development status**: this project is **mature** and **actively maintained**.

We are looking for contributing developers: if you want to get involved but don't know how, or would like to volunteer helping maintain this lib, [open a discussion](https://github.com/py-pdf/fpdf2/discussions)!

## Installation Instructions

```
pip install fpdf2
```

To get the latest, unreleased, development version straight from the development branch of this repository:

```
pip install git+https://github.com/py-pdf/fpdf2.git@master
```

## Features

- Python 3.10+ support
- [Unicode](https://py-pdf.github.io/fpdf2/Unicode.html) (UTF-8) TrueType font subset embedding
- Internal / external [links](https://py-pdf.github.io/fpdf2/Links.html)
- Embedding images, including transparency and alpha channel
- Arbitrary path drawing and basic [SVG](https://py-pdf.github.io/fpdf2/SVG.html) import
- Embedding [barcodes](https://py-pdf.github.io/fpdf2/Barcodes.html), [charts & graphs](https://py-pdf.github.io/fpdf2/Maths.html), [emojis, symbols & dingbats](https://py-pdf.github.io/fpdf2/EmojisSymbolsDingbats.html)
- [Tables](https://py-pdf.github.io/fpdf2/Tables.html) and also [cell / multi-cell / plaintext writing](https://py-pdf.github.io/fpdf2/Text.html), with [automatic page breaks](https://py-pdf.github.io/fpdf2/PageBreaks.html), line break and text justification
- Choice of measurement unit, page format & margins. Optional page header and footer
- Basic [conversion from HTML to PDF](https://py-pdf.github.io/fpdf2/HTML.html)
- A [templating system](https://py-pdf.github.io/fpdf2/Templates.html) to render PDFs in batches
- Images & links alternative descriptions, for accessibility
- Table of contents & [document outline](https://py-pdf.github.io/fpdf2/DocumentOutlineAndTableOfContents.html)
- [Document encryption](https://py-pdf.github.io/fpdf2/Encryption.html) & [document signing](https://py-pdf.github.io/fpdf2/Signing.html)
- [Annotations](https://py-pdf.github.io/fpdf2/Annotations.html), including text highlights, and [file attachments](https://py-pdf.github.io/fpdf2/FileAttachments.html)
- [Presentation mode](https://py-pdf.github.io/fpdf2/Presentations.html) with control over page display duration & transitions
- Optional basic Markdown-like styling: `**bold**, __italics__`
- Can render [mathematical equations & charts](https://py-pdf.github.io/fpdf2/Maths.html)
- Usage examples with [Django](https://www.djangoproject.com/), [Flask](https://flask.palletsprojects.com), [FastAPI](https://fastapi.tiangolo.com/), [streamlit](https://streamlit.io/), AWS lambdas... : [Usage in web APIs](https://py-pdf.github.io/fpdf2/UsageInWebAPI.html)
- more than 1300 unit tests running under Linux & Windows, with `qpdf`-based PDF diffing, timing & memory usage checks, and a high code coverage

Our 350+ reference PDF test files, generated by `fpdf2`, are validated using 3 different checkers:

[![QPDF logo](https://py-pdf.github.io/fpdf2/qpdf-logo.svg)](https://github.com/qpdf/qpdf) [![PDF Checker logo](https://py-pdf.github.io/fpdf2/pdfchecker-logo.png)](https://www.datalogics.com/repair-pdf-files) [![VeraPDF logo](https://py-pdf.github.io/fpdf2/vera-logo.jpg)](https://verapdf.org)

## Please show the value

Choosing a project dependency can be difficult. We need to ensure stability and maintainability of our projects. Surveys show that GitHub stars count play an important factor when assessing library quality.

⭐ Please give this repository a star. It takes seconds and will help your fellow developers! ⭐

## Please share with the community

This library relies on community interactions. Please consider sharing a post about `fpdf2` and the value it provides 😊

[![GitHub Repo stars](https://img.shields.io/badge/share%20on-reddit-red?logo=reddit)](https://reddit.com/submit?url=https://github.com/py-pdf/fpdf2&title=fpdf2) [![GitHub Repo stars](https://img.shields.io/badge/share%20on-hacker%20news-orange?logo=ycombinator)](https://news.ycombinator.com/submitlink?u=https://github.com/py-pdf/fpdf2) [![GitHub Repo stars](https://img.shields.io/badge/share%20on-twitter-03A9F4?logo=twitter)](https://twitter.com/share?url=https://github.com/py-pdf/fpdf2&t=fpdf2) [![GitHub Repo stars](https://img.shields.io/badge/share%20on-facebook-1976D2?logo=facebook)](https://www.facebook.com/sharer/sharer.php?u=https://github.com/py-pdf/fpdf2) [![GitHub Repo stars](https://img.shields.io/badge/share%20on-linkedin-3949AB?logo=linkedin)](https://www.linkedin.com/shareArticle?url=https://github.com/py-pdf/fpdf2&title=fpdf2)

## Documentation

- [Documentation Home](https://py-pdf.github.io/fpdf2/)
- Tutorial in several languages: [English](https://py-pdf.github.io/fpdf2/Tutorial.html) - [Deutsch](https://py-pdf.github.io/fpdf2/Tutorial-de.html) - [español](https://py-pdf.github.io/fpdf2/Tutorial-es.html) - [हिंदी](https://py-pdf.github.io/fpdf2/Tutorial-hi.html) - [português](https://py-pdf.github.io/fpdf2/Tutorial-pt.html) - [Русский](https://py-pdf.github.io/fpdf2/Tutorial-ru.html) - [Italian](https://py-pdf.github.io/fpdf2/Tutorial-it.html) - [français](https://py-pdf.github.io/fpdf2/Tutorial-fr.html) - [Ελληνικά](https://py-pdf.github.io/fpdf2/Tutorial-gr.html) - [עברית](https://py-pdf.github.io/fpdf2/Tutorial-he.html) - [简体中文](https://py-pdf.github.io/fpdf2/Tutorial-zh.html) - [বাংলা](https://py-pdf.github.io/fpdf2/Tutorial-bn.html) - [ភាសាខ្មែរ](https://py-pdf.github.io/fpdf2/Tutorial-km.html) - [日本語](https://py-pdf.github.io/fpdf2/Tutorial-ja.html) - [Dutch](https://py-pdf.github.io/fpdf2/Tutorial-nl.html) - [Polski](https://py-pdf.github.io/fpdf2/Tutorial-pl.html) - [Türkçe](https://py-pdf.github.io/fpdf2/Tutorial-tr.html) - [Indonesian](https://py-pdf.github.io/fpdf2/Tutorial-id.html)- [Slovenščina](https://py-pdf.github.io/fpdf2/Tutorial-sl.html)
- Release notes: [CHANGELOG.md](https://github.com/py-pdf/fpdf2/blob/master/CHANGELOG.md)
- A series of blog posts: [fpdf2 tag @ ludochaordic](https://chezsoi.org/lucas/blog/tag/fpdf2.html)

You can also have a look at the `tests/`, they're great usage examples!

## Development

Please check the [dedicated documentation page](https://py-pdf.github.io/fpdf2/Development.html).

## Contributors ✨

This library could only exist thanks to the dedication of many volunteers around the world:

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification ([emoji key](https://allcontributors.org/docs/en/emoji-key)). Contributions of any kind welcome!

[![Contributors map](https://py-pdf.github.io/fpdf2/contributors-map-small.png)](https://py-pdf.github.io/fpdf2/contributors.html)

*(screenshot from January 2023, click on the map above to access an up-to-date online version)*

## Community, related tools, alternative libraries

More about those in [the documentation](https://py-pdf.github.io/fpdf2/#community).

## **Details **

<dl>

<dt>Version</dt>
<dd>2.9.0</dd>

<dt>License</dt>
<dd>LGPL-3.0-only</dd>

<dt>Python</dt>
<dd>&gt;=3.11</dd>

<dt>Maintainer</dt>
<dd>Olivier PLATHEY, Max, Lucas Cimon (@Lucas-C), Georg Mischler (@gmischler), Anderson Herzogenrath da Costa (@andersonhc)</dd></dl>

## **Links**

- [Code](https://github.com/py-pdf/fpdf2)
- [Documentation](https://py-pdf.github.io/fpdf2/)
- [Homepage](https://py-pdf.github.io/fpdf2/)
- [Issue tracker](https://github.com/py-pdf/fpdf2/issues)
- [View on PyPI](https://pypi.org/project/fpdf2/)

## **Release Cadence **

**5**

releases in the past year

avg 64 days between releases

## **Maintainers **

- Olivier PLATHEY
- Max
- Lucas Cimon (@Lucas-C)
- Georg Mischler (@gmischler)
- Anderson Herzogenrath da Costa (@andersonhc)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://pypx.app/#website","@type":"WebSite","description":"The Python Package Index, reimagined. Fast search, dependency insights, download trends, and changelogs — all in one place.","name":"pypx","url":"https://pypx.app/"},{"@id":"https://pypx.app/packages/fpdf2#webpage","@type":"WebPage","description":"Simple & fast PDF generation for Python","name":"fpdf2","url":"https://pypx.app/packages/fpdf2","isPartOf":{"@id":"https://pypx.app/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://pypx.app/packages/fpdf2"]}]},{"@id":"https://pypx.app/packages/fpdf2#/schema/software-application/1","@type":"SoftwareApplication","applicationCategory":"DeveloperApplication","description":"Simple & fast PDF generation for Python","license":"LGPL-3.0-only","name":"fpdf2","softwareVersion":"2.9.0"}]}
```

## Sitemap

See the full [sitemap](https://pypx.app/sitemap.md) for all pages.
