Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://py-pdf.github.io/fpdf2/
Simple PDF generation for Python
https://py-pdf.github.io/fpdf2/
barcode hacktoberfest library markdown pdf pdf-generation pdf-library python python3 svg
Last synced: about 1 month ago
JSON representation
Simple PDF generation for Python
- Host: GitHub
- URL: https://py-pdf.github.io/fpdf2/
- Owner: py-pdf
- License: lgpl-3.0
- Fork: true (reingart/pyfpdf)
- Created: 2017-03-15T15:31:54.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-05-29T03:54:48.000Z (8 months ago)
- Last Synced: 2024-05-29T05:49:38.693Z (8 months ago)
- Topics: barcode, hacktoberfest, library, markdown, pdf, pdf-generation, pdf-library, python, python3, svg
- Language: Python
- Homepage: https://py-pdf.github.io/fpdf2/
- Size: 301 MB
- Stars: 966
- Watchers: 22
- Forks: 227
- Open Issues: 50
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
- awesome-python - py-pdf.github.io/fpdf2
README
[![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, pylint, semgrep](https://img.shields.io/badge/checks-bandit,pylint,semgrep,grype-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)](http://makeapullrequest.com)
[![first-timers-only Friendly](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](http://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:
```python
from fpdf import FPDFpdf = 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/), [defusedxml](https://pypi.org/project/defusedxml/), & [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
```bash
pip install fpdf2
```To get the latest, unreleased, development version straight from the development branch of this repository:
```bash
pip install git+https://github.com/py-pdf/fpdf2.git@master
```## Features
* Python 3.8+ 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 coverageOur 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/products/pdf-tools/pdf-checker/)
[![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)
- 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:
Mariano Reingart
๐ป
David Ankin
๐ ๐ป ๐ ๐ง ๐ฌ ๐ โ ๏ธ
Alex Pavlovich
๐ ๐ป ๐ ๐ฌ ๐ โ ๏ธ
Lucas Cimon
๐ ๐ป ๐ ๐ ๐ง ๐ฌ ๐
Miroslav ล edivรฝ
๐ป โ ๏ธ
Florian Bernhart
๐ป โ ๏ธ
Edwood Ocasio
๐ป โ ๏ธ
Marcelo Duarte
๐ป
Roman Kharin
๐ป ๐ค
Christopher Frost
๐ ๐ป
Michael Kalbermatten
๐ ๐ป
Yanone
๐ป
Leo Zhu
๐ป
Abishek Goda
๐ป
Arthur Moore
๐ป โ ๏ธ ๐
Bogdan Cuza
๐ป
Craig Hobbs
๐ป
xitrushiy
๐ ๐ป
Josรฉ L. Redrejo Rodrรญguez
๐ป
Jรผrgen Gmach
๐ป
Larivact
๐ป
Leonel Cรขmara
๐ป
Mark Steadman
๐ ๐ป
Sergey
๐ป
Stan-C421
๐ป
Viraj Shah
๐ป
cornicis
๐ป
moe-25
๐ป ๐ ๐ฌ ๐
Simone Bizzotto
๐ป
Boonyawe Sirimaha
๐
T
๐ป ๐จ
AubsUK
๐ฌ
Georg Mischler
๐ ๐ป ๐จ ๐ ๐ค ๐ฌ โ ๏ธ
ping
๐
Portfedh
๐ โ
Tabarnhack
๐ป
Mridul Birla
๐
digidigital
๐
Xit
๐
Alexander Burchenko
๐
Andrรฉ Assunรงรฃo
๐
Quentin Brault
๐
Paula Campigotto
๐ ๐ป ๐
bettman-latin
๐ป
oleksii-shyman
๐ป ๐จ ๐ค
lcomrade
๐ ๐ ๐ป
pwt
๐ ๐ป
Martin Cerveny
๐ ๐ป
Spenhouet
๐ ๐
mtkumar123
๐ป
Davide Consalvo
๐ป ๐ฌ ๐จ
Bruno Santos
๐
cgkoutzigiannis
โ ๏ธ
I Wayan Kurniawan
๐
Sven Eliasson
๐
gonzalobarbaran
๐ป
Nuttapat Koonarangsri
๐ ๐
Sokratis Vasiliou
๐
semaeostomea
๐ ๐ป
Josuรฉ Millรกn Zamora
๐ป
me-suzy
๐
dmail00
๐ ๐ป
Gerardo Allende
๐ป ๐ฌ
Nicholas Jin
๐
Yusuke
๐ป
Tillrzhtgrfho
๐
Dario Ackermann
๐
Tzvi Greenfeld
๐ ๐
devdev29
๐ ๐ป
Johan Bonneau
๐
Jesรบs Alberto Muรฑoz Mesa
โ ๏ธ ๐ ๐
Jaydeep Das
๐ฌ
Sean
๐ป
Anderson Herzogenrath da Costa
๐ฌ ๐ป ๐ฌ ๐ ๐ ๐ค
Yi Wei Lan
โ ๏ธ
CpDong
๐ป ๐ ๐
CY-Qiu
๐
Markovvn1
๐ป
Elad Rapaport
๐ป
SfinxV
๐
bramantoleksono
๐
TheNerdy907
๐
Elie Roux
๐ ๐ค ๐ป ๐ฌ
msalem
๐
Manuel Ruiz
๐
Noel
๐
Avik Sarkar
๐ ๐ ๐ฌ
aeris07
๐
KamarulAdha
๐
Valerus5685
๐
Sebastian Tia
๐ป
Eugene Selifonov
๐
Kuth
๐
Ruben de Bruin
๐ ๐ป ๐
stenci
๐
alcnaka
๐
Tolker-KU
๐ป
lfavole
๐ป
Nicolai Wolfrom
๐
Sandra
๐ค ๐ป
navitho
๐
Sai Harsha Kottapalli
๐ป
Rakesh N J
๐
rodos
๐
Ted Brookings
๐ป
Andy Friedman
๐ป
Matt
๐
matipos2
๐
lry12138
๐
Martijn Jasperse
๐ ๐ป
demiurgepy
๐
Marek Tovlin
๐ป
Polderrider
๐
Elena ``of Valhalla''
โ ๏ธ
Niall O'Callaghan
๐
jsid72
๐
Alan Collins
๐ป
hyperstown
๐
Clock-Speed
๐ป
Darek
๐
Carl Higgs
๐ป
awmc000
๐ป
Scott Smitelli
๐
lcgeneralprojects
๐ ๐ป
Christopher Lane
๐ โ ๏ธ
David
๐ป
Sezer Bozkฤฑr
๐
Odhy Pradhana
๐
Li
๐
Matthias Schoettle
๐
Steve Simmons
๐
Joรฃo Henrique
๐
Bernhard Miklautz
๐
Bryn Jeffries
๐
Benoit Charbonneau
๐ค
Philip Jones
๐
opposss
๐ป
Dat Le
๐ ๐ป
Kaustubh
๐ป
Derek Robinson
๐
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).