- Using Sphinx’s built-in LaTeX builder
- Using the
sphinx-simplepdfextension (Recommended)
Other tools exist for this task —
rst2pdf, pandoc, sphinx-pdf-generate — but they are not covered here.Method 1: Built-in LaTeX Builder
This method generates LaTeX source files from your Sphinx content and then compiles them into a PDF using a LaTeX distribution such as TeX Live (cross-platform) or MiKTeX (Windows)._build/latex directory and then attempts to compile them into a PDF.
If you encounter Unicode character issues during compilation, set the latex_engine in your conf.py:
conf.py
Method 2: sphinx-simplepdf Extension (Recommended)
The sphinx-simplepdf extension is more straightforward and user-friendly. It simplifies PDF generation and handles various content types more reliably than the LaTeX route.
sphinx-simplepdf depends on WeasyPrint. Follow the WeasyPrint installation guide for your platform before proceeding.sphinx_simplepdf to the extensions list in conf.py:
conf.py