---
title: "Exporting blog posts from HTML to ePub and PDF"
language: en
topics: ["blog", "book", "literature", "programming", "technology", "writing"]
full_article_url: https://willem.com/en/2026-01-19_offline-reading/
---
# Exporting blog posts from HTML to ePub and PDF

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

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

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.
