Skip to content

Actions Status PyPI - Python Version PyPI PyPI - Downloads codecov GitHub contributors PyPI - License

mkdocs-print-site-plugin↵

MkDocs plugin that adds a page to your site combining all pages, allowing your site visitors to File > Print > Save as PDF the entire site.

Installation↵

Install the plugin using pip3:

pip3 install mkdocs-print-site-plugin

Next, add the following lines to your mkdocs.yml:

plugins:
  - search
  - print-site

⚠ Make sure to put print-site to the bottom of the plugin list. This is because other plugins might alter your site (like the navigation), and you want these changes included in the print page.

If you have no plugins entry in your config file yet, you'll likely also want to add the search plugin. MkDocs enables it by default if there is no plugins entry set.

Supported themes↵

The plugin ships print stylesheets (margins, page breaks, hiding navigation) for the mkdocs-material, mkdocs-materialx, mkdocs and readthedocs themes.

Other themes will still get a print page, but you'll see a warning that print margins and page breaks might be off. Feel free to open an issue to request support for your theme, or write your own stylesheet using the include_css option.

mkdocs-material plugins↵

The print page works with the built-in mkdocs-material plugins, except the social plugin, which does not add social cards to the print page. With the blog plugin, the posts follow the blog page, newest first, like on the blog. The archive and category pages are left out, because they only list posts.

Usage↵

  • Navigate to /print_page/ or print_page.html, or link to it from a page with [print page](print_page.md), like any other page. With enabled: false, there is no print page, and MkDocs warns about the link.
  • Export to standalone HTML (see export to HTML)
  • Export to PDF using your browser using File > Print > Save as PDF (see export to PDF)

Which pages are included↵

The print page combines the Markdown pages in your navigation, in navigation order. Empty pages and pages matching the exclude option are left out. HTML files in the navigation are left out, because they bring their own layout, styles and scripts. This includes API docs generated as an HTML site, such as by mkdocs-typedoc. To get those into the print page, generate Markdown instead (for TypeDoc, use typedoc-plugin-markdown) and write it to your docs/ folder.

Multiple languages↵

With mkdocs-static-i18n, every language gets its own print page: /print_page/ for the default language and /<language>/print_page/ for the others, such as /fr/print_page/. With the mkdocs-material theme, the language selector on a print page links to the print pages of the other languages.