Skip to main content

A Sphinx extension to generate individual PDF files for each documentation page.

Project description

Downloads License Supported versions GitHub Docs CI Action status GitHub CI Action status PyPI Package latest release black code style

Sphinx PDF Generate

A Sphinx extension to generate individual PDF files for each documentation page.

Sphinx-PDF-Generate extension generates separate PDF files from each HTML page derived from your Sphinx RST files page in your Sphinx documentation using WeasyPrint.

The extension supports many advanced features such as table of contents, customisable cover page , support for CSS paged media module CSS paged media module , and using Sphinx page metadata to generate cover page.

If you find Sphinx-PDF Generate useful, please consider starring the project. Thank you!

Requirements

  1. This package requires Sphinx version 5.0 or higher.

  2. Python 3.8 or higher

  3. WeasyPrint depends on cairo, Pango and GDK-PixBuf which need to be installed separately. Please follow the installation instructions for your platform carefully:
  4. Explicit support for your Sphinx theme is probably required using custom CSS. As of now, the supported themes are Sphinx-Material and Sphinx-Immaterial. A generic version will just generate the PDF files and put the download link into a <link> tag.

Installation

Install the package with pip

pip install sphinx-pdf-generate

Install from source repository

cd [YOUR_PROJECT_DIRECTORY]
git clone https://github.com/iSOLveIT/sphinx-pdf-generate
cd sphinx-pdf-generate
pip install -e .

You can refer to the installation page for information.

Activate Extension

You can activate the extension in your conf.py file by adding the following:

extensions = ["sphinx_pdf_generate"]

You can then set the appropriate extension configuration. Visit the options page on our documentation website to read more.

Usage

You can generate PDF documents for your documentation project by using the command sphinx-pdf-generate sourcedir outdir as below:

$ sphinx-pdf-generate docs/source docs/_build/html

After the documentation build is complete, you should now see the following message at the end of your build output:

[sphinx-pdf-generate] Converting 7 file(s) to PDF took 12.1s

In your OUTPUTDIR e.g.(docs/_build/html) you should now have a PDF file for every RST document you decided to build.

You can refer to the quickstart page for a good introduction to Sphinx-PDF Generate.

Contributing

From reporting a bug to submitting a pull request: every contribution is appreciated and welcome. Report bugs, ask questions and request features using GitHub issues.

If you want to contribute to the code of this project, please read the Contribution Guidelines.

Special thanks

Many thanks to Terry Zhao the author of the MkDocs PDF Export Plugin and Jonathan Stoppani the author of the Sphinx-Autobuild Plugin.

Their projects inspired the creation of this plugin. We’ve used some of their code in this project.

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

sphinx_pdf_generate-0.0.4.tar.gz (29.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sphinx_pdf_generate-0.0.4-py3-none-any.whl (40.8 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_pdf_generate-0.0.4.tar.gz.

File metadata

  • Download URL: sphinx_pdf_generate-0.0.4.tar.gz
  • Upload date:
  • Size: 29.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.1 CPython/3.9.18 Linux/6.5.0-1015-azure

File hashes

Hashes for sphinx_pdf_generate-0.0.4.tar.gz
Algorithm Hash digest
SHA256 7259cbc6dc1d2c5fc22abfe7ac197ba6e4f83db8103feb6813f6e317b1d5cc3f
MD5 038d0ae8261ae54a646107ac19fe0ff2
BLAKE2b-256 c9bfc349b6c09bf39f863b7352c8350bfefaba83e3ac80f73c4178a3775beed5

See more details on using hashes here.

File details

Details for the file sphinx_pdf_generate-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: sphinx_pdf_generate-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 40.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.1 CPython/3.9.18 Linux/6.5.0-1015-azure

File hashes

Hashes for sphinx_pdf_generate-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 216e18c406a2845c2ec1f9c3b87251af4d92ad11d891ce637550b8f12530b765
MD5 f4bed66f6c45d7ef37f97e6f025a90a5
BLAKE2b-256 b082e681ccb96f98de3a6b6c00804f2e216fc488b6017ee4b7b47b7c6447064b

See more details on using hashes here.

Supported by

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