Skip to main content

Convert reStructured Text to PDF via ReportLab.

Project description

https://img.shields.io/pypi/v/rst2pdf.svg https://img.shields.io/pypi/pyversions/rst2pdf.svg https://img.shields.io/pypi/l/rst2pdf.svg

rst2pdf: Use a text editor. Make a PDF.

The usual way of creating PDF from reStructuredText is by going through LaTeX. This tool provides an alternative by producing PDF directly using the ReportLab library.

More information is available at the main website.

Features

  • User-defined page layout. Multiple frames per page, multiple layouts per document.

  • Page transitions

  • Cascading stylesheet mechanism, define only what you want changed.

  • Supports TTF and Type1 font embedding.

  • Any number of paragraph styles using the class directive.

  • Any number of character styles using text roles.

  • Custom page sizes and margins.

  • Syntax highlighter for many languages, using Pygments.

  • Supports embedding almost any kind of raster or vector images.

  • Supports hyphenation.

  • Sphinx integration

  • Full user’s manual

Installation

rst2pdf supports Python 3.9 or greater. Version 0.102 was the last version to support Python 3.8. Version 0.99 was the last version to support Python 3.6 & 3.7, with 0.97 the last version to support Python 2.7.

Install from PyPI (pipx)

The latest released version may be installed from PyPI by using pipx:

$ pipx install rst2pdf

rst2pdf also has support for a number of features that require additional dependencies. Installation of all the required dependencies using pipx may be installed using:

$ pipx install rst2pdf[aafiguresupport,mathsupport,plantumlsupport,rawhtmlsupport,sphinx,svgsupport]

Install from PyPI (uv)

As with pipx above, the latest released version may be installed from PyPI by using uv:

$ uv tool install rst2pdf

If you don’t have uv, please see the installation docs

Installation of all the required dependencies using uv may be installed using:

$ uv tool install rst2pdf[aafiguresupport,mathsupport,plantumlsupport,rawhtmlsupport,sphinx,svgsupport]

Install from Snap

If you are using a system that supports snaps then you can install from there with:

$ snap install rst2pdf

Install from GitHub

Work on rst2pdf has restarted on GitHub, with the goals of adding new features, addressing outstanding issues, and not breaking anything. You can clone the repository and install this version:

$ git clone https://github.com/rst2pdf/rst2pdf
$ cd rst2pdf
$ git checkout <desired-branch> # if you want something other than main
$ uv tool install .[aafiguresupport,mathsupport,plantumlsupport,rawhtmlsupport,sphinx,svgsupport]

If you intend to work on rst2pdf’s source code, see doc/DEVELOPERS.rst.

Usage

To convert a reStructuredText document to a PDF, simply run:

$ rst2pdf <document name> output.pdf

For information on available options, use -h:

$ rst2pdf -h

To enable basic integration with Sphinx, modify your conf.py file to enable the rst2pdf.pdfbuilder extension and configure the pdf_documents option. For example:

extensions = [
    # ...
    'rst2pdf.pdfbuilder',
]

# Grouping the document tree into PDF files. List of tuples
# (source start file, target name, title, author, options).
pdf_documents = [
    ('index', 'MyProject', 'My Project', 'Author Name'),
]

For information on the pdf_documents option and the many other options available, refer to the manual.

Contributing

See CONTRIBUTING.

Code of conduct

rst2pdf is an inclusive and welcoming community. To participate in this project, everyone is bound by our Community Code of Conduct.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rst2pdf-0.103.1.tar.gz (12.2 MB view details)

Uploaded Source

Built Distribution

rst2pdf-0.103.1-py3-none-any.whl (177.2 kB view details)

Uploaded Python 3

File details

Details for the file rst2pdf-0.103.1.tar.gz.

File metadata

  • Download URL: rst2pdf-0.103.1.tar.gz
  • Upload date:
  • Size: 12.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.11

File hashes

Hashes for rst2pdf-0.103.1.tar.gz
Algorithm Hash digest
SHA256 3ffe816d4b3275aee21b8ffdd08b2e6be4d7590cd88b189f733cbc6996d63786
MD5 e806058707cd622eccb97f15d4d71da9
BLAKE2b-256 a5d281347228284659ce6789a6c3f10c6cac1d71c8ea44f86c748f3b01e3dd3f

See more details on using hashes here.

File details

Details for the file rst2pdf-0.103.1-py3-none-any.whl.

File metadata

File hashes

Hashes for rst2pdf-0.103.1-py3-none-any.whl
Algorithm Hash digest
SHA256 10baf9ca1638a228500635369ecf9850270c62b8608f49788556636aeb5c65b8
MD5 638b62c5196bb77b4f281bb48199e1d6
BLAKE2b-256 6dbdd5713e8c6bb9b91f57c686c5ac97a80d2b5f92b889a9e61ea96c7b2a614f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page