It's a MkDocs plugin that export your documentation in a single PDF file
The MkPDFs plugin will export yor documentation in your MkDocs repository as a PDF file using WeasyPrint.
Unlike other plugin where customizing the design of the generated PDF is complicated, this plugin brings the ability to completely control the design of the generated PDF.
What makes this plugin particular, is that:
- Your documentation is exported as a single PDF file
- The order of pages fits the navigation as defined in the MkDocs configuration file
- The ability to override the default design to make it fit your needs
- The ability to exclude some files from the generated PDF
- No layout issues
- No conflict with the theme design
- Table of contents integrated in the PDF
- This package requires MkDocs version 1.0
- Python 3.4 or higher
- WeasyPrint depends on cairo, Pango and GDK-PixBuf which need to be installed separately. Please follow your platform installation instructions carefully:
The PDF version of the documentation will not be created if the used generated page content's is not enclosed in an
<article> tag or in a
<div> tag with property
Install the package with
pip3 install mkpdfs-mkdocs
Enable the plugin in your
mkdocs.yml as folowing
plugins: - search - mkpdfs
or with options
plugins: - search - mkpdfs: - company: The War Company Inc. - author: Monsieur Silvestre
Note: If you enable this plugin and you don't have
pluginsentry in your MkDocs config file yet, you will need to explicitly enable the
searchplugin. This plugin is enabled by default when no
pluginsentry is set.
You can find further information about plugins in the MkDocs documentation.
How does it work?
When building or serving your documentation with
mkdocs build or
mkdocs serve, the following message will be displayed if everything wend smoothly:
The PDF version of the documentation has been generated.
This plugin supports following options to allow you better handle the customisation of the generated PDF.
||The author of the document. This information will be printed on the cover page of the generated PDF.|
||If this documentation is from a company, then you should provide this information. It will be displayed on the front page of the documentation, bellow the author information|
||The table of content title. The default value is Table of Contents|
||The position of the table of contents. This option supports 3 differents values:
||The file name of the generated PDF, relative to the
||Relative to your
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.
The idea of this plugin has raised while working on a project in the public sector. After many research I found some plugins that guided me to the current solution. They have inspired me a lot, so many thanks to:
- Terry Zhao the author of the MkDocs PDF Export Plugin the source of our inspiration. We've used some of his code in this project.
- Kozea team for bringing WeasyPrint to us as an open source project. The default design of the generated PDF is based on their work report Sample.
- Martin Donath the author of Material for MkDocs, some of his css file were used to design the layout of Admonition, Codehilite, Arthmatex, emoji, and more.