HTML to PDF

Posted in HTML by

Write your text in markdown, export it to HTML, convert it to PDF. This allows you to have a readable source and distribute your text in a portable format.

Markdown

A easy to use Markdown Editor can be found at [markdownpad.com] (http://markdownpad.com/). Export it as html by using the Menu->File->Export HTML.

HTML to PDF

You often have images and other elements on your page, or you must provide a document in multiple formats. Download wkhtmltopdf and solve your problem by letting it convert your HTML document to PDF. Open a command prompt (type cmd in the address bar) and adjust this code to your needs.

wkhtmltopdf path\to\input.html path\to\output.pdf

You can specify to use landscape by adding "-O landscape" after wkhtmltopdf.

Tip: Pagebreak

<div style="page-break-after: always;">
<span style="display: none;">&nbsp;</span>
</div>

This code will force a pagebreak and gives you more control over the pdf output.

Published at , Updated at 2013-03-02

prev: Introduction to HTML