This repository has been archived on 2026-08-28. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • Python 99.6%
  • CSS 0.4%
Find a file
Matt Marcha 16bea8360f
Some checks failed
build / Test - Python 3.10 (push) Has been cancelled
build / Test - Python 3.11 (push) Has been cancelled
build / Test - Python 3.12 (push) Has been cancelled
build / Test - Python 3.13 (push) Has been cancelled
build / Test - Python 3.14 (push) Has been cancelled
build / Lint (push) Has been cancelled
build / Deploy (push) Has been cancelled
fix: More checks before generation
Add Article&Page objects to filter and check if source file exists to avoid errors when generating PDFs.
2026-08-06 15:45:13 +02:00
.github/workflows ref: Remove GH funding file 2026-01-19 16:36:48 -10:00
pelican/plugins/to_pdf fix: More checks before generation 2026-08-06 15:45:13 +02:00
.cruft.json build: Update github repo link (to revert) 2025-12-16 07:22:35 -10: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
CONTRIBUTING.md build: Update github repo link (to revert) 2025-12-16 07:22:35 -10:00
pyproject.toml build: Update github repo link (to revert) 2025-12-16 07:22:35 -10:00
README.md build: Update github repo link (to revert) 2025-12-16 07:22:35 -10:00
tasks.py chore: init 2025-12-15 17:48:54 -10:00

To PDF: A Plugin for Pelican

Build Status PyPI Version Downloads License

To PDF is a Pelican plugin for generating custom PDFs from articles and pages. Works on top of wkhtmltopdf and pdfkit.

Installation

This plugin can be installed via:

python -m pip install pelican-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 to_pdf to your existing PLUGINS list. For more information, please see the How to Use Plugins documentation.

Prerequises

  • 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.