Use command line to convert files to PDF

Piner's Avatar


11 Mar, 2013 08:58 AM

I want to write a makefile and convert changed MD file to PDF.
Does Marked support command line convert?

  1. Support Staff 1 Posted by Brett on 11 Mar, 2013 11:49 AM

    Brett's Avatar

    No. You'll need to look into dedicated command line apps like wkhtmltopdf
    or wkpdf in combination with the multimarkdown CLI.

  2. 2 Posted by Torsten Grust on 12 Oct, 2013 01:32 PM

    Torsten Grust's Avatar

    When I use's export to HTML (*Include preview template in output* is selected) and then use wkpdf or wkhtmltopdf — the two give essentially the same result — to convert to PDF, I get output that closely resembles the output generated by Marked2's PDF export.

    Text in both outputs differs in size, though: in the Marked2-generated PDF output, text appears to be noticeably smaller (about a factor of 2).

    Does Marked2 shrink text on PDF export or otherwise treat text size specially? What could be an explanation for these considerable text size differences?


  3. Support Staff 3 Posted by Brett on 12 Oct, 2013 04:43 PM

    Brett's Avatar

    I'll have to do some testing, but it's likely because there are certain settings included in the Marked preview that aren't exported as part of the stylesheet (in order to avoid overriding certain custom styles). I'll check and see if there's something amiss, though.


  4. 4 Posted by Torsten Grust on 12 Oct, 2013 04:49 PM

    Torsten Grust's Avatar

    Thanks, Brett. That would be great!


  5. Support Staff 5 Posted by Brett on 13 Oct, 2013 01:49 PM

    Brett's Avatar

    @Torsten : I'm actually unable to replicate this issue. Do you have a custom style or are your zoom settings non-default?

  6. 6 Posted by Torsten Grust on 14 Oct, 2013 11:47 AM

    Torsten Grust's Avatar

    Well yes, I am using a custom style. But that's why I use Marked2's "Include preview template in output" option: Marked2 and the external conversion to PDF use the same stylesheet.

    I dig deeper into this in the course of this week and then get back.

    And: Thanks for taking a look at this in the first place!


    P.S. My use case for this: provide in-text-editor (here: Sublime Text) feedback to the user when a page of HTML-formatted Markdown will exceed the size of a printed page. Implementation: on save, editor sends relevant section of Markdown source to `mmd` and then through the external HTML-to-PDF converter to measure page count. For this to work sensibly, I need the external HTML-to-PDF conversion to create the same number of pages as Marked2's own PDF export.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac