Personal tools
Contact Us 24/7 > 1 866.SIX FEET
Sections

Skip to content. | Skip to navigation

Home > Blog > Markdown to PDF in one command line

Markdown to PDF in one command line

written by Calvin Hendryx-Parker on 05/19/09
— filed under: , , ,

We have started responding to many documents now using plain text files since it is very easy to manage and to collaborate with other team members. Now, what if you want to send off a professional looking formatted structured document with a table of contents. You also want it to be in a common format so that others can annotate on it or send you feedback. PDF is perfect for this, but how do you get your very functional markdown to a very pretty PDF presentation?

Markdown.pl ~/Desktop/mytextfile.markdown | SmartyPants.pl | htmldoc --book --footer . -f output.pdf -

Enjoy! As a bonus I included SmartyPants, which is also by the creator of Markdown and it gives you some nice typographical elements just as smart quotes and em-dashes. Also, I would check out the documentation on htmldoc, it is pretty powerful and can even embed background images and custom headers and footers.

Posted by Dave on 11/09/11
Here is a tool for Windows that converts MultiMarkdown to PDF:
http://code.google.com/p/mmd2pdf
Posted by Pradeep Gowda on 05/03/12
or use markdown2pdf that is part of pandoc install (sudo apt-get install pandoc):

    $ markdown2pdf mytextfile.txt 

PDF is produced using LaTeX, which is the gold standard for typesetting.

See http://johnmacfarlane.net/pandoc/README.html#creating-a-pdf
Posted by Calvin Hendryx-Parker on 05/03/12
I actually use Multimarkdown and wkhtmltopdf so that I can setup things like merging multiple markdown docs into one final doc with custom headers/footers and a table of contents that pulls it all together.  I'll write it all up in a new post. This old post was mostly a placeholder for me to remember how I did this.
Add comment

You can add a comment by filling out the form below. Plain text formatting.

(Required)
(Required)
puzzle
Sections