Create PDF from Sphinx using WeasyPrint.
Go to file
Kujiu 309307f1ce
Initial release
2020-06-19 02:21:35 +02:00
build/lib/sphinx_weasyprint_builder Initial release 2020-06-19 02:21:35 +02:00
sphinx_weasyprint_builder Initial release 2020-06-19 02:21:35 +02:00
.gitignore First commit 2020-06-10 22:14:35 +02:00
AUTHORS First commit 2020-06-10 22:14:35 +02:00
CHANGES Initial release 2020-06-19 02:21:35 +02:00
LICENSE First commit 2020-06-10 22:14:35 +02:00
LICENSE-de First commit 2020-06-10 22:14:35 +02:00
LICENSE-fr First commit 2020-06-10 22:14:35 +02:00
LICENSE-nl First commit 2020-06-10 22:14:35 +02:00
README.rst Initial release 2020-06-19 02:21:35 +02:00
babel.cfg First commit 2020-06-10 22:14:35 +02:00
requirements.txt Initial release 2020-06-19 02:21:35 +02:00
setup.cfg First commit 2020-06-10 22:14:35 +02:00
setup.py Initial release 2020-06-19 02:21:35 +02:00

README.rst

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> </head>

Sphinx WeasyPrint builder

Sphinx WeasyPrint builder is a PDF generator for Sphinx without usage of LaTeX.

Install

You can install it with pip:

pip install sphinx_weasyprint_builder

Or with setup.py:

python setup.py install

Configuration

You can configure your output with these options:

  • weasyprint_basename

  • weasyprint_theme

  • weasyprint_theme_options

  • weasyprint_title

  • weasyprint_theme_path

  • weasyprint_short_title

  • weasyprint_style

  • weasyprint_css_files

  • weasyprint_show_copyright

  • weasyprint_show_sphinx

Each one has the same behavior of its equivalent for html builder.

In addition, you can set these three variables:

  • weasyprint_main_selector

  • weasyprint_footer_selector

  • weasyprint_header_selector

This builder analyzes generated HTML to extract with BeautifulSoup a footer and a header. They are removed from main HTML and reinjected on each page, conforming to theme's CSS. By default, no header and no footer.

Use compatible selectors for BeautifulSoup.

Use

Just launch the following:

make weasyprint

Why an other PDF builder for Sphinx?

LaTeX is really hard to use and to personalize. There's also an other project to make PDF without LaTeX.

WeasyPrint converts HTML to PDF. It's the easiest way to customize theme and use a constant quality whatever the media is. If your HTML theme doesn't have any JavaScript, you can imagine use the same as HTML and PDF output.

This plugin is just singlehtml output with conversion to PDF.

</html>