guilin 桂林 guilin 桂林 - 2 months ago 23
Markdown Question

mkd2pdf, wkhtmltopdf, how to make PDF for slide

I want to make PDF by mkd2pdf which base on wkhtmltopdf

It can generate PDF from markdown, it use a css file to control the style. just like this

h1 {
page-break-before: always;
}


so, I can make a slide, and each
# h1 #
will be a new page. It has close to my goals that generate slide from markdown.

but the output PDF is A4 ratio, I need a 4:3 ratio which fit page to full screen. I think wkhtmltopdf have some option, or some print control css can control this, but I don't know how.

Answer

the output PDF is A4 ratio, I need a 4:3 ratio which fit page to full screen. I think wkhtmltopdf have some option, or some print control css can control this, but I don't know how.

See: http://madalgo.au.dk/~jakobt/wkhtmltoxdoc/wkhtmltopdf-0.9.9-doc.html

The default page size of the rendered document is A4, but using the --page-size option this can be changed to almost anything else, such as: A3, Letter and Legal. For a full list of supported pages sizes please see http://doc.trolltech.com/4.6/qprinter.html#PageSize-enum.

For a more fine grained control over the page size the --page-height and --page-width options may be used

And:

--page-height       <unitreal>      Page height (default unit millimeter)
--page-size         <size>          Set paper size to: A4, Letter, etc.
--page-width        <unitreal>      Page width (default unit millimeter)

UPD: Docs by this URL might be less outdated: http://wkhtmltopdf.org/usage/wkhtmltopdf.txt

Comments