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

Blog

Markdown to PDF in one command line

written by Calvin Hendryx-Parker on Tuesday May 19, 2009
Comments | 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 Nov 09, 2011 02:53 PM
Here is a tool for Windows that converts MultiMarkdown to PDF: http://code.google.com/p/mmd2pdf
Posted by Pradeep Gowda on May 03, 2012 08:26 PM
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 May 03, 2012 10:54 PM
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.

puzzle

Next Steps


Select a type of support:

Contact our sales team

First name:
Last name:
Email:
Phone Number:
Message:
Fight spam:
What is + ?
 
Call Us 1 866.SIX FEET
Sections