Skip to content

rkowalski4/pyfpdf

 
 

Repository files navigation

Pull Requests Welcome build status Pypi latest version License: LGPL v3

pyfpdf: FPDF for Python

codecov PyPI version

Minimalist PDF creation library for Python

from fpdf import FPDF

document = FPDF()
document.add_page()
document.set_font('Arial', size=12)
document.cell(w=0, txt="hello world")
document.output("hello_world.pdf")

PyFPDF is a library for PDF document generation under Python, ported from PHP (see FPDF: "Free"-PDF, a well-known PDFlib-extension replacement with many examples, scripts and derivatives).

Compared with other PDF libraries, PyFPDF is simple, small and versatile, with advanced capabilities, and is easy to learn, extend and maintain.

Looking for Developer Help!

Installation Instructions:

You can install PyFPDF from PyPI, with easyinstall or from Windows installers. For example, using pip:

pip install fpdf2

To get the latest development version you can download the source code running, you will need Pillow (pip install pillow)

# Linux only:
sudo apt-get install libjpeg-dev libpython-dev zlib1g-dev # libpython3.3-dev #(if necessary)

# Linux and Windows:
git clone https://github.com/alexanderankin/pyfpdf.git
cd pyfpdf
python setup.py install

Features:

  • Python 3.6+ support (2.7 not supported since version 2.1)
  • Unicode (UTF-8) TrueType font subset embedding
  • Internal/External Links
  • PNG, GIF and JPG support (including transparency and alpha channel)
  • Shape, Line Drawing
  • Cell/Multi-cell/Plaintext writing, Automatic page breaks
  • Basic html2pdf (Templates with a visual designer in the works)
  • Exceptions support, other minor fixes, improvements and PEP8 code cleanups
  • Tox tests

Release notes: CHANGELOG.md

Documentation:

Documentation Home.

Also read the design-spec/tests, they're great.

Developers:

To get development environment going, on Linux/Ubuntu:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6 python3.7 python3.8 python3.9 \
  libpython3.6-dev libpython3.7-dev libpython3.8-dev \
  libpython3.9-dev
sudo apt-get install python3-distutils
wget 'https://bootstrap.pypa.io/get-pip.py'
python get-pip.py
sudo pip install tox

Lets try to improve the Code Coverage statistic so that we can safely transition to external font and image libraries, and more...

About

Simple PDF generation for Python (FPDF PHP port) [FORK]

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 78.2%
  • HTML 21.5%
  • Shell 0.3%