๐ŸŒ
Reportlab
docs.reportlab.com
ReportLab Docs
Direct Python access to our PDF parsing and reuse code (in ReportLab PLUS) Docs
Demos
3) product_catalogue/ - An XML product listing converted to a fully customisable PDF in seconds. 4) graphic_card/ - This shows the use of reportlab/graphics to make a very simple "image card",
Quick Start Guide
The PDF document output is generated from the RML using the python module 'rml2pdf'. RML is normally used in conjuction with a templating system. All our examples include ReportLabโ€™s Preppy templating system. It was developed in late 2000 and has been in continual production use ever since then.
Installation
Current instructions for (versions >=3) (Free to evaluate) ยท Older instructions (versions 2.x) (Free to evaluate)
Chapter 7
If the pyphen python module is installed attribute hyphenationLang controls which language will be used to hyphenate words without explicit embedded hyphens. If embeddedHyphenation is set then attempts will be made to split words with embedded hyphens. Attribute uriWasteReduce controls how we attempt to split long uri's. It is the fraction of a line that we regard as too much waste. The default in module reportlab...
๐ŸŒ
Python Assets
pythonassets.com โ€บ posts โ€บ create-pdf-documents-in-python-with-reportlab
Create PDF Documents in Python With ReportLab | Python Assets
February 12, 2022 - How to write PDF documents (text, images, graphics, grids, and more) from Python using the ReportLab library.
Discussions

Reportlab python Pdf - Stack Overflow
I have this type of code which helps me to build pdf from data render from database. But there is a problem if length of a string is too big then it overcross to other string like in billing head. ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Is the Python PDF generator library ReportLab easy to learn?
Reportlab is A MESS! The documentation is very confusing, there aren't really any tutorials or YouTube videos to help you. I would avoid Reportlab. Maybe have a look at xhtml2pdf. It's based on Reportlab, but pretty easy to use. Although it's not really actively maintained. More on reddit.com
๐ŸŒ r/learnpython
7
2
January 16, 2021
PDF image in PDF document using ReportLab (Python) - Stack Overflow
I saved some plots from matplotlib into a pdf format because it seems to offer better quality. How do I include the PDF image into a PDF document using ReportLab? The convenience method Image(filen... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Best library for creating graphic PDF documents?
i would check out quarto, it supports python code natively and has support for cross-references, TOC, etc. that makes for really polished docs More on reddit.com
๐ŸŒ r/Python
46
64
March 6, 2024
๐ŸŒ
Reportlab
docs.reportlab.com โ€บ reportlab โ€บ userguide โ€บ ch1_intro
Chapter 1: Introduction - ReportLab Docs
We need your help to make sure ... is signposted from www.reportlab.com. This is a software library that lets you directly create documents in Adobe's Portable Document Format (PDF) using the Python programming language....
๐ŸŒ
PyPI
pypi.org โ€บ project โ€บ reportlab
reportlab ยท PyPI
The ReportLab Toolkit. An Open Source Python library for generating PDFs and graphics.
      ยป pip install reportlab
    
Published ย  Feb 12, 2026
Version ย  4.4.10
๐ŸŒ
pdf noodle
pdfnoodle.com โ€บ home โ€บ blog โ€บ how to generate pdf using reportlab in python (updated 2025)
How to Generate PDF Using ReportLab in Python (Updated 2025) - pdf noodle
October 15, 2025 - Learn how to generate PDFs from HTML using ReportLab in Python. Step-by-step example covering setup, customization, and dynamic data generation.
๐ŸŒ
Reportlab
reportlab.com โ€บ docs โ€บ reportlab-userguide.pdf pdf
ReportLab PDF Library User Guide ReportLab Version 4.4.10
This release (4.4.10) of ReportLab requires Python versions 3.9+ or higher. If you need to use Python 2, please use the latest ReportLab 2.7 package that is suitable for you. ... ReportLab is an Open Source project. Although we are a commercial company we provide the core PDF gen-
๐ŸŒ
Reportlab
docs.reportlab.com โ€บ reportlab โ€บ userguide โ€บ ch2_graphics
Chapter 2: Graphics and text with pdfgen - ReportLab Docs
The demo script reportlab/demos/stdfonts.py will print out two test documents showing all code points in all fonts, so you can look up characters. Special characters can be inserted into string commands with the usual Python escape sequences; for example \101 = 'A'. The verbosity argument determines how much log information is printed. By default, it is zero to assist applications which want to capture PDF ...
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 66904399 โ€บ reportlab-python-pdf
Reportlab python Pdf - Stack Overflow
from io import BytesIO from django.http import HttpResponse from pdfme import build_pdf def sea_export_local_invoice_pdf(request, pk): document = { "sections": [ { "content": [ { "widths": [1, 5, 1, 1, 1, 1.2, 1.5, 1, 1, 1, 1.5, 1.5], "style": {"s": 8, "cell_margin": 2}, "table": [ [ {'.b': 'S.No'}, {'.b': 'Charges Description'}, {'.b': 'SAC'}, {'.b': 'Unit'}, {'.b': 'Rate'}, {'.b': 'Ex.Rate'}, {'.b': 'Amount'}, {'.b': 'IGST'}, {'.b': 'CGST'}, {'.b': 'SGST'}, {'.b': 'Tax Amt'}, {'.b': 'Total'} ], [ 1, "EMPTY EQUIP BALANCE AND HANDOVER CHARGE", 95.9, 2, 2, 2, '8.00', '2%', '0.0', '0.0', 0.16, 8.16 ] ] }, ] } ] } pdf_file = BytesIO() build_pdf(document, pdf_file) response = HttpResponse(pdf_file.read(), content_type='application/pdf') response['Content-Disposition'] = ' filename="local_invoice.pdf"' return response
Find elsewhere
๐ŸŒ
Mouse Vs Python
blog.pythonlibrary.org โ€บ home โ€บ a simple step-by-step reportlab tutorial
A Simple Step-by-Step Reportlab Tutorial - Mouse Vs Python
September 7, 2021 - It is not distributed with that standard library, so youรขโ‚ฌโ„ขll need to download it if you want to run the examples in this tutorial.Anyway, the premier PDF library in Python is Reportlab.thanks for the tips G-d bless ๐Ÿ˜‰
๐ŸŒ
Nicd
nicd.org.uk โ€บ knowledge-hub โ€บ creating-pdf-reports-with-reportlab-and-pandas
Data Deep Dive: Creating PDF reports with ReportLab and Pandas
July 31, 2023 - We have built a PDF report containing figures and tables using ReportLab and Pandas. This process is easily reproducible for other datasets and could be automated for producing reports on a regular basis. While there are other Python libraries available, I believe ReportLab provides great potential for fine-grained control over your reports and adding new content is simple once everything is set up.
๐ŸŒ
Leanpub
leanpub.com โ€บ reportlab
ReportLab - PDF Processing with Python [Leanpub PDF/iPad/Kindle]
October 15, 2025 - Learn how to create PDFs with Python using ReportLab
๐ŸŒ
Reportlab
docs.reportlab.com โ€บ demos โ€บ hello_world โ€บ hello_world
Hello World - ReportLab Docs
If we copy the code above into a file (I call it rl-hello_again.py) and run python3 rl-hello_again.py we can see it outputed a PDF file. Let's do the same again but this time with a little bit of help from rml. The best thing about ReportLab Plus (in my opinion) is if you don't know how to do something, don't worry it's probably already been done before!
๐ŸŒ
Medium
medium.com โ€บ @AlexanderObregon โ€บ creating-pdf-reports-with-python-a53439031117
Creating PDF Reports with Python. Introduction | by Alexander Obregon | Medium
June 26, 2024 - ReportLab is a powerful and versatile open-source library for creating PDF documents using Python. It provides a wide range of functionalities that allow you to generate complex PDFs with text, images, tables, and charts.
๐ŸŒ
GitHub
github.com โ€บ driscollis โ€บ reportlabbookcode
GitHub - driscollis/reportlabbookcode: Code examples for the book, ReportLab: PDF Processing with Python ยท GitHub
August 22, 2025 - This is the code repository for the book, ReportLab: PDF Processing with Python by Michael Driscoll
Starred by 186 users
Forked by 63 users
Languages ย  Python
๐ŸŒ
Python
bugs.python.org โ€บ file607 โ€บ reference.pdf pdf
ReportLab API Reference Introduction
The reportlab package is broken into a number of subpackages. These are as follows: ... working at a low level - individual shapes and lines of text. Internally, it constructs blocks of page ยท marking operators which match your drawing commands, and hand them over to the pdfbase
๐ŸŒ
GitHub
github.com โ€บ cedev935 โ€บ reportlab-python-pdf
GitHub - cedev935/reportlab-python-pdf: A script that generates a pdf file. You can create a new pdf file from an html file or you can write on top of an already existing pdf ยท GitHub
A script that generates a pdf file. You can create a new pdf file from an html file or you can write on top of an already existing pdf - cedev935/reportlab-python-pdf
Author ย  cedev935
Top answer
1 of 4
5

You can use the wonderful pdfrw package together with reportlab and use it to pass file-like objects of matplotlib figures directly into a flowable:

This was answered before, but I want to give a minimal example here, please also look here: https://stackoverflow.com/a/13870512/4497962

from io import BytesIO
import matplotlib.pyplot as plt
from pdfrw import PdfReader, PdfDict
from pdfrw.buildxobj import pagexobj
from pdfrw.toreportlab import makerl
from reportlab.platypus import Flowable
from reportlab.lib.enums import TA_JUSTIFY,TA_LEFT,TA_CENTER,TA_RIGHT

class PdfImage(Flowable):
    """
    PdfImage wraps the first page from a PDF file as a Flowable
    which can be included into a ReportLab Platypus document.
    Based on the vectorpdf extension in rst2pdf (http://code.google.com/p/rst2pdf/)

    This can be used from the place where you want to return your matplotlib image
    as a Flowable:

        img = BytesIO()

        fig, ax = plt.subplots(figsize=(canvaswidth,canvaswidth))

        ax.plot([1,2,3],[6,5,4],antialiased=True,linewidth=2,color='red',label='a curve')

        fig.savefig(img,format='PDF')

        return(PdfImage(img))

    """

    def __init__(self, filename_or_object, width=None, height=None, kind='direct'):
        # If using StringIO buffer, set pointer to begining
        if hasattr(filename_or_object, 'read'):
            filename_or_object.seek(0)
            #print("read")
        self.page = PdfReader(filename_or_object, decompress=False).pages[0]
        self.xobj = pagexobj(self.page)

        self.imageWidth = width
        self.imageHeight = height
        x1, y1, x2, y2 = self.xobj.BBox

        self._w, self._h = x2 - x1, y2 - y1
        if not self.imageWidth:
            self.imageWidth = self._w
        if not self.imageHeight:
            self.imageHeight = self._h
        self.__ratio = float(self.imageWidth)/self.imageHeight
        if kind in ['direct','absolute'] or width==None or height==None:
            self.drawWidth = width or self.imageWidth
            self.drawHeight = height or self.imageHeight
        elif kind in ['bound','proportional']:
            factor = min(float(width)/self._w,float(height)/self._h)
            self.drawWidth = self._w*factor
            self.drawHeight = self._h*factor

    def wrap(self, availableWidth, availableHeight):
        """
        returns draw- width and height

        convenience function to adapt your image 
        to the available Space that is available
        """
        return self.drawWidth, self.drawHeight

    def drawOn(self, canv, x, y, _sW=0):
        """
        translates Bounding Box and scales the given canvas
        """
        if _sW > 0 and hasattr(self, 'hAlign'):
            a = self.hAlign
            if a in ('CENTER', 'CENTRE', TA_CENTER):
                x += 0.5*_sW
            elif a in ('RIGHT', TA_RIGHT):
                x += _sW
            elif a not in ('LEFT', TA_LEFT):
                raise ValueError("Bad hAlign value " + str(a))

        #xobj_name = makerl(canv._doc, self.xobj)
        xobj_name = makerl(canv, self.xobj)

        xscale = self.drawWidth/self._w
        yscale = self.drawHeight/self._h

        x -= self.xobj.BBox[0] * xscale
        y -= self.xobj.BBox[1] * yscale

        canv.saveState()
        canv.translate(x, y)
        canv.scale(xscale, yscale)
        canv.doForm(xobj_name)
        canv.restoreState()
2 of 4
2

According to ReportLab's FAQ this is only possible with ReportLab PLUS:

Can I use vector graphics in my PDFs?

No, the Open Source package doesn't do this. PageCatcher (see the previous answer) allows you to easily incorporate any vector image by saving it as a PDF and then using it exactly as you would an image file, and Report Markup Language accepts PDF files along with JPG, GIF and PNG.

Update: I haven't looked into this for a while but on the page of pdfrw it says:

pdfrw can read and write PDF files, and can also be used to read in PDFs which can then be used inside reportlab.

๐ŸŒ
Reportlab
reportlab.com
Reportlab
The heart of our business is a rock solid codebase for PDF creation. Our tools generate complex, dynamic documents at far higher speeds than any well known desktop solutions ยท ReportLab DocEngineTM is our complete hosted solution for businesses. It marries the ReportLab PDF toolkit to a robust platfom that accepts multiple inputs and offers validation tools, user access controls and audit trails.