Registry / data / rst2pdf

rst2pdf

JSON →
library0.105pypypi✓ verified 82d ago

rst2pdf is a Python library and command-line tool for converting reStructuredText documents to PDF format, leveraging the ReportLab library for PDF generation. It supports various reStructuredText features, including styles, images, and syntax highlighting. The current version is 0.105, and it maintains an active release cadence with frequent minor updates.

pip install rst2pdf
INSTALL
IMPORT
SIG · RST2PDF
R
rst2pdf
datapythonv0.105
Install
4.5s avg
Import
Disk
65MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.105 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 64.2MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 4.5s · import 0.000s · 66MB
65MB installed
● package 65MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

rst2pdf
import rst2pdf
from rst2pdf import rst2pdf

This quickstart demonstrates how to use the rst2pdf Python API to convert a reStructuredText string into a PDF file. The `rst2pdf` function from `rst2pdf.createpdf` is the primary programmatic interface.

import os from rst2pdf.createpdf import rst2pdf rst_content = ''' My PDF Document =============== This is a sample reStructuredText document converted to PDF. * Item A * Item B .. code-block:: python print("Hello, rst2pdf!") .. note:: This is a generated PDF using rst2pdf. ''' output_filename = "sample_document.pdf" try: # The rst2pdf function can take a string for 'text' and a filename for 'output' rst2pdf(text=rst_content, output=output_filename) print(f"PDF successfully created: {output_filename}") except Exception as e: print(f"Error creating PDF: {e}") print("Please ensure all core dependencies like docutils and reportlab are correctly installed.")
rst2pdf --version
Debug
Known issues
breakingrst2pdf version 0.100 dropped support for Python versions below 3.6, and current versions (0.105) require Python >=3.10. Older Python versions will result in installation failures or runtime errors.
fix
Upgrade your Python environment to 3.10 or newer. Check `requires_python` on PyPI for the exact version range if using an older rst2pdf version.
affects: 0.100 and newer
gotcharst2pdf heavily relies on `ReportLab` and `Docutils` as its core rendering engines. Issues with PDF output (e.g., font rendering, complex layouts, specific styling) or reStructuredText parsing often stem from limitations or quirks within these underlying libraries, not always directly from rst2pdf itself.
fix
Consult `ReportLab` and `Docutils` documentation for advanced styling, font embedding, or troubleshooting parsing issues. Ensure system-level dependencies for image processing (e.g., `libjpeg` for Pillow) are met for full functionality.
affects: All versions
deprecatedAs of version 0.104, rst2pdf removed its direct dependency on the `smartypants` library and now uses `docutils`'s built-in typography features for converting ASCII quotes to curly quotes and similar transformations. This might result in subtle rendering differences for documents that relied on specific `smartypants` behavior.
fix
Review PDF output after upgrading to ensure typographical changes are as expected. If specific `smartypants` behavior is critical, consider pinning to an older rst2pdf version or pre-processing your reStructuredText.
affects: 0.104 and newer
Upgrade
Version history
0.105latest on PyPI · released Mar 9, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
30 hits · last 30 days
node
26
OpenAI (training)
1
Resources
rst2pdf — pip install rst2pdf · libregistry