Index / Snippets / Exporting blog posts from HTML to ePub a

Exporting blog posts from HTML to ePub and PDF

epub-gen for ePub, pandoc and LaTeX for PDF.

Answers
How do you export HTML blog posts to ePub and PDF automatically?
Topics
blog · book · literature · programming · technology · writing
Full article on willem.com
https://willem.com/en/2026-01-19_offline-reading/

Summary

I export my blog posts automatically by feeding simplified HTML into two tools: the epub-gen NodeJS module for ePub, and pandoc with LaTeX for PDF. A task manager queues the jobs per translation and file format.

Full text

My website runs on Lemmid, my own content management system, a static site generator in NodeJS that outputs optimised HTML. I extended that code to export every post automatically, using simplified HTML as the input for both formats. For ePub I use the epub-gen module. For PDF I use pandoc with LaTeX. A task manager queues the output jobs per individual translation and per file format, spreading the computational load on the backend. The result is distraction-free, DRM-free offline reading on e-ink devices such as a Kobo or a reMarkable, which are kind to your eyes. The exported files contain high quality images and resizable typography, so the articles read well wherever and whenever you want, without a connection.

Machine formats of this page