News for hackers. Stuff that matters.

Show HN: Mdpdf a 2k line C CLI to convert Markdown to tiny PDFs

https://github.com/schicho/mdpdf

I have always searched for a simple tool which can convert a MD document to a well styled small PDF, just like a GitHub Readme.

This was inspired by TinyPDF https://news.ycombinator.com/item?id=46316968

I also used this project to get familiar with agentic coding, which I had dreaded before.

mdpdf supports:

- using the included PDF fonts to generate tiny valid PDFs

- outputs as A4 or Letter depending on your locale

- plenty of common MD syntax: code blocks, inline code, lists, tables, and jpg and png images

That's it. It covers probably most of the use cases and can help to simply convert a Markdown write-up to a PDF to share.

GitHub: https://github.com/schicho/mdpdf

A simple make call should build it for you.

( 4 comments | 2 points | on HN )
Re:Show HN: Mdpdf a 2k line C CLI to convert Markdown to tin... by overflowy on Thursday April 09, 2026 @07:22PM (#47711585)
You should post a screenshot in the README to let the people know what the rendered PDF looks like.
Re:Show HN: Mdpdf a 2k line C CLI to convert Markdown to tin... by treetalker on Thursday April 09, 2026 @07:38PM (#47711716)
There is an example in the repo: https://github.com/schicho/mdpdf/blob/main/examples/README.p...

(It's vanilla.)

I'd love to see an output option that leaves 40%–60% of the right side of every page blank, for handwritten notes after printing (similar to Tufte layout).

Re:Show HN: Mdpdf a 2k line C CLI to convert Markdown to tin... by japaco on Friday April 10, 2026 @08:09AM (#47716870)
This looks like a great little utility. Nice job!

I would also like to see some markdown to PDF screenshot examples in order to properly visualize the intent. Keep it up!

Re:Show HN: Mdpdf a 2k line C CLI to convert Markdown to tin... by dhruv3006 on Friday April 10, 2026 @04:05AM (#47715019)
Hey this is pretty great project !

I too am building an API client based on markdown and this will do pretty well with it : https://voiden.md/