Sign up ×
Software Recommendations Stack Exchange is a question and answer site for people seeking specific software recommendations. It's 100% free, no registration required.

Almost every existing md to PDF goes through LaTeX: kramdown, pandoc, multimarkdown, etc.

Are there the options that don't, in any language, e.g. using a backend such as Prawn, libharu or jsPDF?

So far I have only found:

If you can convert the HTML subset generated from Markdown to PDF well, then that is a solution, but I am yet to find a free software that does it properly. For example, PhantomJS conversions break markdown links <>, which show as simple styled text on the PDF, not as clickable links that open on preferred browser, which are generated through LaTeX conversions.

Non free possibilities:

Related: Ruby only SO question.

Why I want this: LaTeX is slow, produces horrible error messages, is hard to install, and is overly complex for the small subset needed for Markdown.

Partial solutions:

share|improve this question
Do you care what OS/Web-app? Also how about price? – Nick Wilde Apr 25 '14 at 18:32
@NickWilde The freer the better, the more cross the better. Linux support would make me happy. But I wanna hear all options =) – Ciro Santilli 六四事件 法轮功 包卓轩 Apr 25 '14 at 18:45
Oh and forgot to ask what kind of interface do you want - CLI or GUI. If CLI I have an option that I'm pretty sure doesn't use LaTex. – Nick Wilde Apr 25 '14 at 19:14
@NickWilde I prefer CLI, but once again, I want to know all of them. – Ciro Santilli 六四事件 法轮功 包卓轩 Apr 25 '14 at 19:19
prefer CLI well then that is great :D... answer coming right up. – Nick Wilde Apr 25 '14 at 19:23

8 Answers 8

up vote 13 down vote accepted

Node.js Package Markdown-PDF should work well. I have been using the Grunt package of that, but just for the sake of a good answer I just quickly ran the the original via the command line; and yeap it works great.

So to use the CLI of Markdown-PDF just:

  1. Install Node.js (if necessary)
  2. Install Markdown-PDF - from cmdline just run npm install -g markdown-pdf
  3. run markdown-pdf -o readme.pdf (or whatever source and destination and other options you want; see CLI Options for all the details of what you can specify).

It is Open-Source (MIT licenced), and has a Github repo, it is free and as far as I've found it is is quite fast.

There may be a slight problem with getting images from https:// domains but I haven't investigated what is up there - one of my images is not being loaded so this is most likely just something funny in my md but there is a slight chance that is a bug.

One significant bug: clickable links are not created.

share|improve this answer
Backend: to HTML using Marked, then PhantomJS. @NickWilde: do your <> links survive in the PDF? I get images only. Not sure if this is possible with PhantomJS. – Ciro Santilli 六四事件 法轮功 包卓轩 Apr 25 '14 at 19:48
hmm... I don't have any <link> type links - just [name](link) or [name][id] type linkes and they work. They both have the link text after the link which isn't pretty but probably could be fixed with a minor adjustment - I was forgetting to mention that. – Nick Wilde Apr 25 '14 at 19:59
Can you click on the link once, and it opens on the browser? Which PDF viewer are you using? For Evince and Okular I only get plain styled text. I have tested and same for [](), the text appears on the right, which is a good design since they links are not clickable (for me). – Ciro Santilli 六四事件 法轮功 包卓轩 Apr 25 '14 at 20:08
I'm on Windows (7)/Adobe Acrobat (XI) - the title is not clickable the link text is (and one click opens in preferred browser (after Adobe security warning about opening links). To me that is minor however I can see that could be a breaking issue for some use cases. – Nick Wilde Apr 25 '14 at 20:13
I'll see if I can fix that later – Nick Wilde Apr 25 '14 at 20:17

I've investigated another option. Compared to Markdown-PDF:

  • Pros:
    • Actually makes proper links.
    • Actually slightly quicker to run
  • Cons:
    • Not as "pretty" - except for the links everything looks nicer with Markdown-PDF. This would be easily fixable by adding some CSS to the HTML before PDF generation though*.
    • Installation is more complicated.

This is also a Nodejs based solution which uses the Marked and wkhtmltopdf node packages.


  • Install Nodejs.
  • Install Marked - easiest via commandline: npm -g install marked
  • Install wkhtmltopdf NPM - easiest via commandline: npm -g install wkhtmltopdf
  • Install wkhtmltopdf main files - no installer available.
  • Add wkhtmltopdf bin directory to the PATH


To use takes two CLI calls. You can of course just save this as a batch file and run that.

marked -o output.html
wkhtmltopdf input.html output.pdf

* Because of the links working I may switch to this method instead of Markdown-PDF in which case I'll likely write a wrapper to add some CSS (with an option to add a sensible default or user defined). The wrapper would also make it one call instead of two for running and probably could make it one npm install cmd instead of the manual install. If/when I do that I'll share that here.

share|improve this answer
The following is based on top of wkhtmltopdf: Haven't tried, but I am yet to understand what it does that wkhtmltopdf does not. – Ciro Santilli 六四事件 法轮功 包卓轩 Apr 26 '14 at 6:00
Looks like that is a ruby wrapper for wkhtmltopdf – Nick Wilde Apr 26 '14 at 6:04
I haven't tried it so I can't review how well it works, but this does not do very well on the installability side: the repo is 1Gb, and including a 0.5 Gb Qt fork! – Ciro Santilli 六四事件 法轮功 包卓轩 Apr 27 '14 at 6:10
Er I'm guessing that must be for PDFKit rather than my recommendation - because my recommendation has a total download size of well under 30mb - ~6mb Nodejs, ~16mb wkhtmltopdf and then the wrappers which are relatively small (node-wkhtmltopdf is 2.8kb). – Nick Wilde Apr 27 '14 at 6:40
Ah, I was talking about the wkhtmltopdf repository, but maybe they include tons of things which are not installed. Thanks. – Ciro Santilli 六四事件 法轮功 包卓轩 Apr 27 '14 at 7:00

I personally am a huge fan of pandoc.

Pandoc is the "swiss-army" knife tool of format conversions:

  • Its core source input format supported is Markdown (including any of the major MD "dialects" such as the flavors of GitHub and PHP plus several special extensions). Other input formats are: HTML, rST, Textile, DocBook XML, MediaWiki.
  • As output formats it supports: ConTeXt, LaTeX, PDF and Beamer PDF (albeit requiring LaTeX in the background), MediaWiki, DOCX, DocBook, rST, Textile, ASCIIDoc, texinfo, org (Emacs Org-mode), S5 (HTML slides), Slidy (HTML slides), Slideous (HTML slides), ImpressJS (HTML slides), DZSlides (HTML slides), HTML, HTML5, EPUB, EPUB3
    ...and: manpage (GROFF manpage) and ODT (OpenDocument Text).

Are you still with me? Good.

Did you notice the last two, manpage and ODT?

Well, these are the two output formats which I personally "abuse" as intermediate formats in order to arrive at PDF for final documents when I do not want LaTeX involved.

I've automated my workflow and process chain with the help of a Makefile. So I just need to type make mydoc.latexpdf, or make mydoc.odtpdf, or make mydoc.manpdf. The Makefile is set up to look for an input of mydoc.mmd, and then it sets the appropriate commands in motion: pandoc to create the PDF directly (which in the background first converts to LaTeX and then runs pdflatex itself), ODT or manpage. Then the next command is to create the final format:

  • For my .odtpdf target it runs LibreOffice in headless mode. Here are the basic command lines I use for the (I'm on OS X, so for Linux or Windows you'll have to adapt paths accordingly). Attention, command is in Makefile syntax -- cannot be directly used in Shell without prior adaption:

    (cd /Applications/; \
    ./soffice "-env:UserInstallation=file:///tmp/LibO_Conversion__$(USER)" \
            --headless \
            --convert-to pdf:writer_pdf_Export \
            --outdir $(CURRDIR)/$(FINAL)  $(CURRDIR)/$(BUILD)/$(subst .odtpdf,.odt,$@) ; \
    cd - ; )
  • For my .manpdf target it uses man -t to create PostScript from Pandoc's manpage output file, then uses Ghostscript to create the PDF. It therefore runs:

    man -t <pandoc's manpage output file> \
     | gs -o ${HOME}/<pandoc-sourcedoc-name>.pdf -sDEVICE=pdfwrite -

Customize the look'n'feel of your ODT output

The non-LaTeX path to PDF via ODT is the most "sexy" for me...

  • ...because Pandoc knows how to apply some nice personalized styles to a target ODT if only these styles are properly defined in a myreference.odt ! (These styles will of course then transfer to the PDF too.)

I can then run the Pandoc command (via Makefile or in the Shell) to create an ODT to my likings, complete with the font faces, sizes and colors I prefer, with the page sizes and page headers, footers or backgrounds I defined (again: Makefile syntax!):

     pandoc \
            --toc \
            --toc-depth=4 \
            --to=odt \
            --chapters \
            --normalize \
            --filter=pandoc-citeproc \
            --standalone \
            --smart \
            --reference-odt=$(RESOURCES)/myreference.odt \
            --from=markdown+mmd_title_block+pipe_tables+grid_tables+tex_math_dollars+raw_tex+footnotes+inline_notes+citations+link_attributes \
            --bibliography=$(RESOURCES)/my.bib \
            --csl=$(RESOURCES)/kp.csl \
            --number-sections \
            --output=./$(BUILD)/$@ \

The --from=markdown+...+...+ parameter tells Pandoc to accept several Markdown syntax extensions which I like to use in my MD source files.

The sweet secret to get the styles in the ODT document lies with the --reference-odt=/path/to/myreference.odt command line parameter.

The ODT output works with references and bibliography even (if your Markdown input is properly written for this)!

Using Windows?

In principle, this workflow should work on Windows too, because Pandoc also runs on Windows. I have run Pandoc on Windows before, but I have not myself setup a completely automatic workflow, first "Pandoc: Markdown -> ODT", then ".\soffice: ODT-> PDF" based on a Makefile here, though...

But you may want to explore another path on Windows:

  • create a DOCX output from Pandoc first;
  • then convert the DOCX to PDF (automatically or interactively via WinWord).

Yes, you can also customize the styles of the DOCX output files by using the --reference-docx=my-reference.docx switch. Just create a my-reference.docx file first which uses exactly the styles you want. Pandoc will then extract these from the reference doc and apply them to the output DOCX it generates!

From there, you can look how to convert the intermediate DOCX file to PDF. This can also be done automatically: you may also want to consider OfficeToPDF.exe. It is hosted on CodePlex, licensed with the Apache 2.0 License and available in binary and in source code.

Finally: be sure to use the latest and greatest version of Pandoc (currently v1.13.2.1) -- there have been a lot of features added in recent months, esp. when it comes to DOCX output!

share|improve this answer
My markdown file contains a unicode character and pandoc blocks on it. How could I fix that ? – chmike Oct 7 at 8:38
Add --latex-engine=xelatex or --latex-engine=lualatex to your Pandoc command. The (default) engine pdflatex can't handle Unicode. – Kurt Pfeifle Oct 7 at 8:49

To build on @nick-wilde's solution, if you are using grunt there are plugins for both marked and wkhtmltopdf:

After installing the main wkhtmltopdf binary you can then install the plugins using npm:

npm install grunt-marked --save-dev
npm install grunt-wkhtmltopdf --save-dev

Then use something like this in your Gruntfile.js:

marked: {
  std : {
    files: {
      'out.html' : ['']

wkhtmltopdf: {
  std : {
    src: 'out.html',
    dest: 'out.pdf'

Then in your build you just call the two in succession:

grunt.registerTask('build', ['marked', 'wkhtmltopdf']);

If you want it to look pretty, you'll have to fiddle more with the marked settings, but I'm sure it's doable.

share|improve this answer

Not an automatic way, but…

Markdown is easily converted to HTML, and then, you can convert from HTML to PDF in Safari browser: (in menu) __File -> Export as PDF…


share|improve this answer

I have recently created a service to convert markdown documents to PDF. It supports GitHub flavoured markdown as well as syntax highlighting. The service is located at:

share|improve this answer
Is it open source? What is the underlying technique? – Ciro Santilli 六四事件 法轮功 包卓轩 Aug 27 at 5:57

It's not sexy, but AbiWord will convert HTML to PDF.

So, assuming you've got abiword installed:

markdown > some.html  
abiword -t pdf -o some.pdf some.html
share|improve this answer
Thanks for the tip. Maybe someone can tell us what type of backend they use: generic or reuse a third party tool. – Ciro Santilli 六四事件 法轮功 包卓轩 Nov 22 at 0:00

It's not an installable app, but the online markdown editor Dillinger exports directly to PDF.

share|improve this answer
Dillinger is just a front-end. I think it uses phantomjs for PDF export:… and which I've mentioned in the question. – Ciro Santilli 六四事件 法轮功 包卓轩 May 28 at 14:08
Welcome to Software Recommendations! Please elaborate more on your answer. How does it work? Which features of the question does it fulfill? Are there any downsides? Something particularly noteworthy? Did you use it? – Angelo Fuchs Jul 19 at 7:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.