Here is my experience after following the hints on this page.

  1. pyPDF can't embed images into files. It can only split and merge. (Source: Ctrl+F through its documentation page) Which is great, but not if you have images that are not already embedded in a PDF.

  2. pyPDF2 doesn't seem to have any extra documentation on top of pyPDF.

  3. ReportLab is very extensive. (Userguide) However, with a bit of Ctrl+F and grepping through its source, I got this:

    • First, download the Windows installer and source
    • Then try this on Python command line:

      from reportlab.pdfgen import canvas
      from reportlab.lib.units import inch, cm
      c = canvas.Canvas('ex.pdf')
      c.drawImage('ar.jpg', 0, 0, 10*cm, 10*cm)
      c.showPage()
      c.save()
      

All I needed is to get a bunch of images into a PDF, so that I can check how they look and print them. The above is sufficient to achieve that goal.

ReportLab is great, but would benefit from including helloworlds like the above prominently in its documentation.

Answer from Evgeni Sergeev on Stack Overflow
🌐
GitHub
github.com › py-pdf › fpdf2
GitHub - py-pdf/fpdf2: Simple PDF generation for Python · GitHub
Simple PDF generation for Python. Contribute to py-pdf/fpdf2 development by creating an account on GitHub.
Author: py-pdf
🌐
Nutrient
nutrient.io › blog › sdk › top 10 ways to generate pdfs in python
Top 10 Python PDF generator libraries: Complete guide for developers (2026)
2 weeks ago - Compare 10 Python PDF libraries for 2026 — FPDF, ReportLab, WeasyPrint, Nutrient, and more — with code examples and a decision guide.
Discussions

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
September 18, 2024
How to create PDF files in Python - Stack Overflow
It's the most powerful library in python to create PDF documents. 2021-07-15T02:57:12.773Z+00:00 ... Save this answer. ... Show activity on this post. fpdf works well for me. Much simpler than ReportLab and really free. Works with UTF-8. ... Link/Descrip.: fpdf.org FPDF is a PHP class which allows to generate ... More on stackoverflow.com
🌐 stackoverflow.com
PDF generator, where should I start?
Hi, there are a lot of options for generating PDFs in Python. Here's a tutorial for you how you can create PDFs with pyfpdf . You might also want to look into generating a PDF from HTML using headless Chrome, which makes it much easier to design your template using HTML/CSS. Check out this pychromepdf library that might help: https://pypi.org/project/pychromepdf/ There's also a lot of hosted HTML => PDF APIs that can make this easier, because it can sometimes be complicated to get everything installed on your own server. Here's some examples: https://api2pdf.com https://browserless.io https://docraptor.com https://pdfshift.io I'm also working on a PDF generation tool called DocSpring , and we have a Python API client . DocSpring can fill out existing PDF forms with information, and we also have a HTML/CSS template creator that makes it easy to design and preview your PDF templates. (If you're a student or working on a hobby project then I'd be happy to set you up with a free developer account!) I hope that helps, and please let me know if you have any questions about PDFs! I've been working on DocSpring for the last few years, so I have a lot of experience with debugging weird PDF issues. More on reddit.com
🌐 r/learnpython
11
9
April 28, 2020
Anyway to generate pdf with specific format using Python?
report lab seems to do what you're asking to create the PDF. See the drawString() and line() functions. Have a go and if you need more guidance then show your attempt I'll try and give you a hand. More on reddit.com
🌐 r/learnpython
8
4
December 13, 2023
People also ask

How do I generate a PDF report from HTML in Python?

Use WeasyPrint for print-oriented HTML and CSS, or Playwright with Chromium when the report needs JavaScript. Nutrient API provides hosted HTML-to-PDF conversion with custom fonts, headers, footers, and page numbers.

🌐
nutrient.io
nutrient.io › blog › sdk › top 10 ways to generate pdfs in python
Top 10 Python PDF generator libraries: Complete guide for developers ...
Does Python have built-in PDF generation?

No. Python’s standard library doesn’t include a PDF generator. Use a third-party library such as fpdf2 for basic documents, ReportLab for reports, or WeasyPrint for HTML templates.

🌐
nutrient.io
nutrient.io › blog › sdk › top 10 ways to generate pdfs in python
Top 10 Python PDF generator libraries: Complete guide for developers ...
Is the Python to PDF tool free to use?
Yes. You can convert your Python code to PDF for free without creating an account. Just paste your code, customize the options, and download your PDF.
🌐
codeconvert.ai
codeconvert.ai › home › code to pdf › python to pdf
Python to PDF - Export Python Code with Syntax Highlighting | Free ...
🌐
APITemplate.io
apitemplate.io › home › generate pdfs in python with 7 popular libraries in 2025
Generate PDFs in Python with 7 Popular Libraries in 2025 - APITemplate.io
December 17, 2024 - In this article, We will talk about how to generate PDF using Python, and we will introduce multiple libraries like FPDF, ReportLab, Pyppeteer, Playwright, XHTML2PDF and Pdfkit and the difference between them.
🌐
CodeConvert AI
codeconvert.ai › home › code to pdf › python to pdf
Python to PDF - Export Python Code with Syntax Highlighting | Free Online
You can convert Python code to 50+ other languages, generate new Python code from descriptions, or get step-by-step explanations of your Python code. Try the Python Code Generator ... Yes. You can convert your Python code to PDF for free without creating an account.
🌐
Reddit
reddit.com › r/python › best library for creating graphic pdf documents?
r/Python on Reddit: Best library for creating graphic PDF documents?
September 18, 2024 -

I have an application for which I need to auto-generate some diagrams as PDF files. The graphics aren't anything particularly fancy, just line drawings and some text.

My first instinct was to generate LaTeX code in Python to draw the graphics with TikZ, but I feel like there's probably a better way without the middleman. I see there are a variety of different libraries for generating PDFs, so I'm looking for someone who has used one or more of them to maybe point me towards one which would suit my needs the best.

Edit: I should mention that I currently am manually creating the diagrams in LaTeX with TikZ. It works "well" (speaking as someone fluent in LaTeX, I doubt anyone who isn't would think this is a good solution at all), but it feels weird to add an extra step of generating code that generates the files instead of generating the files I need directly. But TikZ is a good example of the type of control I need - these diagrams aren't super fancy, just showing and labeling arrangements of chairs in rooms.

🌐
Real Python
realpython.com › creating-modifying-pdf
Create and Modify PDF Files in Python – Real Python
March 3, 2026 - How do you create new PDF files from scratch with Python?Show/Hide · You can create new PDF files from scratch using the ReportLab library. By using the Canvas class, you can draw text, set fonts, and define page sizes to generate customized ...
Find elsewhere
🌐
Anvil
anvil.works › learn › tutorials › pdfs
Generating PDFs with Python - Anvil Works
In Anvil, generating a PDF document is easy and we only need to use Python. Any Anvil Form can be made into a PDF with just a single function call! We can render an Anvil Form as a PDF by turning it into a Media Object.
🌐
GeeksforGeeks
geeksforgeeks.org › python › creating-pdf-documents-with-python
Creating PDF Documents with Python - GeeksforGeeks
January 19, 2026 - PDF (Portable Document Format) is widely used for documents that require a fixed layout and consistent appearance. Using Python, we can create PDF files programmatically with the help of the ReportLab library.
🌐
Templated
templated.io › blog › generate-pdfs-in-python-with-libraries
How to Generate PDFs in Python: 8 Tools Compared (Updated for 2025)
September 16, 2024 - PDFs remain a universally accepted format, ideal for sharing documents across different platforms and devices without compatibility issues. In this updated guide for 2025, we’ll explore how to generate PDFs in Python using popular libraries including FPDF2, ReportLab, Playwright, Pyppeteer, Python-Wkhtmltopdf, PDFKit, WeasyPrint, and Borb.
🌐
PyPI
pypi.org › project › python-pdf
python-pdf · PyPI
If you’re on another OS or architecture your mileage may vary, it is likely that you’ll need to supply your own wkhtmltopdf binary and point pydf towards it by setting the WKHTMLTOPDF_PATH environment variable. ... import pydf pdf = ...
🌐
Python GUIs
pythonguis.com › examples › python pdf report generator
Python PDF Report Generator
April 8, 2026 - Learn how to build a Python PDF report generator using reportlab and pdfrw. Create a desktop GUI with PyQt or PySide to fill PDF templates, overlay text on existing PDFs, and batch generate reports from CSV files.
🌐
e-iceblue
e-iceblue.com › en › pdf › python-create-pdf.html
How to Create PDF Using Python: A Comprehensive Guide
January 8, 2024 - Learn to how to create PDF files using Python, including code example for creating PDF from scratch, generating PDFs from TXT, HTML.
🌐
GitHub
github.com › SajixInc › PDF-Generator-Python
GitHub - SajixInc/PDF-Generator-Python: PDF-Generator-Python · GitHub
pdfkit is a python library that can be used to generate PDF documents from HTML content easily and with automated flow control such as pagination and keeping text together.
Starred by 5 users
Forked by 4 users
Languages: Python 61.4% | HTML 38.6%
🌐
Medium
akpolatcem.medium.com › creating-various-pdf-files-via-python-eba91a40df9d
PDF File Generation using Python. PDF generation is today an easy task… | by ca | Medium
April 29, 2022 - The second version is more actual and offers more features. pdfkit and weasyprint are HTML based solutions. They can create PDF files from URL, HTML file or a string. As they also include CSS, much more pleasant PDF files can be generated. Likewise, reportlab mixes HTML, CSS and python to generate PDF files.
🌐
Nutrient
nutrient.io › blog › sdk › how to generate pdf reports from html in python
Python HTML to PDF (2026): WeasyPrint setup, Django, and a high-volume API
August 10, 2026 - WeasyPrint(opens in a new tab) is an open source Python library for converting HTML and CSS to PDF. The latest release (February 2026) requires Python 3.10 or higher. It supports modern CSS features, including flexbox, grid, and CSS paged media ...
🌐
IronPDF
ironpdf.com › how-tos › create pdf
Create PDF in Python: HTML, File & URL Methods | IronPDF
June 5, 2023 - Automating PDF creation in Python lets developers generate documents programmatically: invoices, reports, contracts, and certificates, without leaving the application.
🌐
Anvil
anvil.works › blog › generate-pdf-with-python
Generating PDF Reports from a Python Script - Anvil Works
If we run our script, we have created a complete sales report in PDF form! You now have a Python script that will generate a beautiful PDF report – and you know how to design more!
🌐
Mouse Vs Python
blog.pythonlibrary.org › home › python 101 – how to generate a pdf
Python 101 - How to Generate a PDF - Mouse Vs Python
September 28, 2021 - Learn how to create a PDF with Python and ReportLab. You'll learn about Canvas methods, PLATYPUS, Paragraphs, Tables and more!