pyfpdf.github.io
Open in
urlscan Pro
2606:50c0:8002::153
Public Scan
Submitted URL: http://pyfpdf.github.io/fpdf2/index.html
Effective URL: https://pyfpdf.github.io/fpdf2/index.html
Submission: On June 27 via api from CA — Scanned from CA
Effective URL: https://pyfpdf.github.io/fpdf2/index.html
Submission: On June 27 via api from CA — Scanned from CA
Form analysis
2 forms found in the DOM<form class="md-header__option" data-md-component="palette"> <input class="md-option" data-md-color-media="(prefers-color-scheme: dark)" data-md-color-scheme="slate" data-md-color-primary="indigo" data-md-color-accent="indigo"
aria-label="Switch to light mode" type="radio" name="__palette" id="__palette_1"> <label class="md-header__button md-icon" title="Switch to light mode" for="__palette_2" hidden=""> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path
d="M12 18c-.89 0-1.74-.2-2.5-.55C11.56 16.5 13 14.42 13 12c0-2.42-1.44-4.5-3.5-5.45C10.26 6.2 11.11 6 12 6a6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12 20 8.69Z">
</path>
</svg> </label> <input class="md-option" data-md-color-media="(prefers-color-scheme: light)" data-md-color-scheme="default" data-md-color-primary="indigo" data-md-color-accent="indigo" aria-label="Switch to dark mode" type="radio"
name="__palette" id="__palette_2"> <label class="md-header__button md-icon" title="Switch to dark mode" for="__palette_1"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M12 8a4 4 0 0 0-4 4 4 4 0 0 0 4 4 4 4 0 0 0 4-4 4 4 0 0 0-4-4m0 10a6 6 0 0 1-6-6 6 6 0 0 1 6-6 6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12 20 8.69Z"></path>
</svg> </label> </form>
Name: search —
<form class="md-search__form" name="search"> <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false"
data-md-component="search-query" required=""> <label class="md-search__icon md-icon" for="__search"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"></path>
</svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"></path>
</svg> </label>
<nav class="md-search__options" aria-label="Search"> <button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41Z"></path>
</svg> </button> </nav>
</form>
Text Content
Skip to content Planning to move fpdf2 to the @py-fpdf GitHub org: read more by clicking there fpdf2 Project Home Type to start searching PyFPDF/fpdf2 * 2.7.4 * 701 * 180 fpdf2 PyFPDF/fpdf2 * 2.7.4 * 701 * 180 * Project Home Project Home Table of contents * Main features * Tutorials * Installation * Displaying deprecation warnings * Community * Support * They use fpdf2 * Related * Misc * Tutorial Tutorial * Jupyter notebook * Tutorial in English * Tutorial auf Deutsch * Tutorial en español * Tutorial en français * Φροντιστήριο στα ελληνικά * Tutorial in italiano * ភាសខ្មែរ * Tutorial em português * Учебник на русском языке * हिंदी में ट्यूटोरियल * বাংলা * מדריך בעברית * 简体中文教程 * Page Layout Page Layout * Page Format and Orientation * Margins * Templates * Tables * Text Content Text Content * Adding Text * Line breaks * Page breaks * Text styling * Unicode * Emojis, Symbols & Dingbats * HTML * Graphics Content Graphics Content * Images * Shapes * Transformations * Transparency * Barcodes * Drawing * SVG * Charts & Graphs * PDF Features PDF Features * Links * Metadata * Annotations * Presentation Mode * Document outline & table of contents * Encryption * Signing * File attachments * Mixing other libs Mixing other libs * Combine with borb * Combine with pdfrw * Combine with PyPDF2 * Matplotlib, Pandas, Plotly, Pygal * Templating with Jinja * Usage in web APIs * Database storage * Development Development * Development guidelines * Logging * API * FAQ Table of contents * Main features * Tutorials * Installation * Displaying deprecation warnings * Community * Support * They use fpdf2 * Related * Misc FPDF2¶ fpdf2 is a library for simple & fast PDF document generation in Python. It is a fork and the successor of PyFPDF (cf. history). Latest Released Version: from fpdf import FPDF pdf = FPDF() pdf.add_page() pdf.set_font('helvetica', size=12) pdf.cell(txt="hello world") pdf.output("hello_world.pdf") Go try it now online in a Jupyter notebook: or MAIN FEATURES¶ * Easy to use, with a user-friendly API, and easy to extend * Python 3.7+ support * Unicode (UTF-8) TrueType font subset embedding (Central European, Cyrillic, Greek, Baltic, Thai, Chinese, Japanese, Korean, Hindi and almost any other language in the world) * Internal / external links * Embedding images, including transparency and alpha channel, using Pillow (Python Imaging Library) * Arbitrary path drawing and basic SVG import * Embedding barcodes, charts & graphs, emojis, symbols & dingbats * Tables, and also cell / multi-cell / plaintext writing, with automatic page breaks, line break and text justification * Choice of measurement unit, page format & margins. Optional page header and footer * Basic conversion from HTML to PDF * A templating system to render PDFs in batchs * Images & links alternative descriptions, for accessibility * Table of contents & document outline * Document encryption & document signing * Annotations, including text highlights, and file attachments * Presentation mode with control over page display duration & transitions * Optional basic Markdown-like styling: **bold**, __italics__ * It has very few dependencies: Pillow, defusedxml, & fonttools * Can render mathematical equations & charts * Many example scripts available throughout this documentation, including usage examples with Django, Flask, FastAPI, streamlit, AWS lambdas... : Usage in web APIs * Unit tests with qpdf-based PDF diffing, and PDF samples validation using 3 different checkers: TUTORIALS¶ * English * Deutsch * Italian * español * français * हिंदी * português * Русский * Ελληνικά * עברית * 简体中文 * বাংলা * ភាសខ្មែរ INSTALLATION¶ From PyPI: pip install fpdf2 To get the latest, unreleased, development version straight from the development branch of this repository: pip install git+https://github.com/PyFPDF/fpdf2.git@master Developement: check the dedicated documentation page. DISPLAYING DEPRECATION WARNINGS¶ DeprecationWarnings are not displayed by Python by default. Hence, every time you use a newer version of fpdf2, we strongly encourage you to execute your scripts with the -Wd option (cf. documentation) in order to get warned about deprecated features used in your code. This can also be enabled programmatically with warnings.simplefilter('default', DeprecationWarning). COMMUNITY¶ SUPPORT¶ For community support, please feel free to file an issue or open a discussion. THEY USE FPDF2¶ * Undying Dusk : a video game in PDF format, with a gameplay based on exploration and logic puzzles, in the tradition of dungeon crawlers * OpenDroneMap : a command line toolkit for processing aerial drone imagery * OpenSfM : a Structure from Motion library, serving as a processing pipeline for reconstructing camera poses and 3D scenes from multiple images * RPA Framework : libraries and tools for Robotic Process Automation (RPA), designed to be used with both Robot Framework * Concordia : a platform developed by the US Library of Congress for crowdsourcing transcription and tagging of text in digitized images * wudududu/extract-video-ppt : create a one-page-per-frame PDF from a video or PPT file. fpdf2 also has a demo script to convert a GIF into a one-page-per-frame PDF: gif2pdf.py * csv2pdf : convert CSV files to PDF files easily RELATED¶ * Looking for alternative libraries? Check out this detailed list of PDF-related Python libs by Patrick Maupin (pdfrw author). There is also borb, PyPDF2, pikepdf, WeasyPrint, pydyf and PyMuPDF: features comparison, examples, Jupyter notebooks. We have some documentations about combining fpdf2 with borb, pdfrw, & PyPDF2. * Create PDFs with Python : a series of tutorial videos by bvalgard * digidigital/Extensions-and-Scripts-for-pyFPDF-fpdf2 : scripts ported from PHP to add transpareny to elements of the page or part of an image, allow to write circular text, draw pie charts and bar diagrams, embed JavaScript, draw rectangles with rounded corners, draw a star shape, restrict the rendering of some elements to screen or printout, paint linear / radial / multi-color gradients gradients, add stamps & watermarks, write sheared text... MISC¶ * Release notes: CHANGELOG.md * This library could only exist thanks to the dedication of many volunteers around the world: list & map of contributors * You can download an offline PDF version of this manual: fpdf2-manual.pdf Back to top Made with Material for MkDocs