HTML to PDF is a Pelican plugin for generating PDFs from specific articles and pages HTML files. Works on top of wkhtmltopdf and pdfkit.
  • Python 99.6%
  • CSS 0.4%
Find a file
2026-08-08 18:52:43 +00:00
.forgejo/workflows Merge pull request 'Refactor' (#1) from refactor into main 2026-08-08 20:42:40 +02:00
pelican/plugins/html_to_pdf style: Fix import order for linter 2026-08-08 19:54:06 +02:00
.cruft.json refactor: Rename & update repo links 2026-08-08 19:13:37 +02:00
.editorconfig chore: init 2025-12-15 17:48:54 -10:00
.gitignore chore: init 2025-12-15 17:48:54 -10:00
.pre-commit-config.yaml chore: init 2025-12-15 17:48:54 -10:00
CHANGELOG.md Release HTML to PDF 2.0.0 2026-08-08 18:52:43 +00:00
CONTRIBUTING.md refactor: Rename & update repo links 2026-08-08 19:13:37 +02:00
pyproject.toml Release HTML to PDF 2.0.0 2026-08-08 18:52:43 +00:00
README.md refactor: Rename & update repo links 2026-08-08 19:13:37 +02:00
tasks.py refactor: Rename & update repo links 2026-08-08 19:13:37 +02:00

HTML to PDF: A Plugin for Pelican

Build Status PyPI Version Downloads License

HTML to PDF is a Pelican plugin for generating PDFs from specific articles and pages HTML files. This plugins differs from the PDF Pelican plugin as :

  • It generates a PDF only for the articles/pages flagged for.
  • The generation is based on the HTML files and can be styled with CSS

Works on top of wkhtmltopdf and pdfkit.

Installation

This plugin can be installed via:

python -m pip install pelican-html-to-pdf

As long as you have not explicitly added a PLUGINS setting to your Pelican settings file, then the newly-installed plugin should be automatically detected and enabled. Otherwise, you must add html_to_pdf to your existing PLUGINS list. For more information, please see the How to Use Plugins documentation.

Dependancies

  • wkhtmltopdf (system)
  • pdfkit (Python)

Usage

Simply add the metadata To_pdf to your page to trigger a PDF generation for the page/article. The value can be empty, or a python dictionnary to set the file name and/or add a stylesheet :

To_pdf: {'name': 'mysuperfile', 'css': 'content/static/print.css'}

Note :

  • PDF files will be generated at the same path as the HTML file.
  • Identical names at same path will result in overwriting.

Emojis

For emojis support in wkhtmltopdf, the font has to be set to one with emoji support which will depend of the system or has to be fetched online (ex: Noto Color Emoji on my system). For emojis added through css content, use the unicode.

Contributing

Contributions are welcome and much appreciated. Every little bit helps. You can contribute by improving the documentation, adding missing features, and fixing bugs. You can also help out by reviewing and commenting on existing issues.

To start contributing to this plugin, review the Contributing to Pelican documentation, beginning with the Contributing Code section.

License

This project is licensed under the AGPL-3.0 license.