Skip to main content

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.

Release files for pelican-html-to-pdf 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pelican-html-to-pdf 2.0.0
File Size Uploaded
pelican_html_to_pdf-2.0.0.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pelican-html-to-pdf 2.0.0
File Interpreter ABI Platform
pelican_html_to_pdf-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.4 kB

Release files / pelican_html_to_pdf-2.0.0.tar.gz

Download URL pelican_html_to_pdf-2.0.0.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d612d45db1e4d26f4fbef755c9d3674fb3814d6540a9f5bd9c1198d12fdb6b87
BLAKE2b-256 checksum
How to use checksums
2722696eae1cb708f99dd41aeee57223b99fde370406c96efac967c320238aec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / pelican_html_to_pdf-2.0.0-py3-none-any.whl

Download URL pelican_html_to_pdf-2.0.0-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6259c1a55df1a4cca8116a56eb7e959d6d8f3e68f1b1abc87f7f5fa5a7740f68
BLAKE2b-256 checksum
How to use checksums
654e15afbc1714b649dcfa3a27c7de82865c9657b032c6d846dac1797c93b143
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page