HACKER Q&A
📣 waleedk

How do you convert AI-generated Markdown into high-quality PDFs?


I thought "markdown → PDF" would be trivial in 2025. It hasn't been so far.

I've been building a tool that generates AI-powered analysis reports in markdown (github.com/ansari-project/ragdiff - not a plug, just context). Getting high-quality, readable PDFs turned out way harder than expected.

The problem:

Markdown is underspecified, so tools have to make guesses. Most solutions produce mediocre output or are painful to work with:

- Pandoc: Powerful but requires deep LaTeX knowledge to get good results. Template debugging is arcane, and the LaTeX intermediate step adds surprising complexity.

- npm packages: Most produce poor typography, awkward page breaks, and inconsistent spacing.

- wkhtmltopdf and similar: Limited styling control, quirky rendering behavior.

What I actually need: proper margins, good fonts, readable code blocks, sensible page breaks, high quality diagrams from things like mermaid etc.

My current solution:

Markdown → HTML (with CSS) → Headless Chrome → PDF

But this feels like reinventing the wheel.

Is there a better way in 2025? What do you use for programmatic markdown → PDF when quality actually matters? Am I missing an obvious tool, or is "Chrome as PDF engine" actually the pragmatic solution?


  👤 kha1n3vol3 Accepted Answer ✓
Eisvogel is a clean pandoc LaTeX template to convert your markdown files to PDF or LaTeX. The project includes a variety of useful templates. see https://github.com/Wandmalfarbe/pandoc-latex-template

👤 robthebrew
Have you tried googling it?