xhtml2pdf(1) PDF generator using HTML and CSS


xhtml2pdf [-b base path] [--base=base path] [-c CSS file] [--css=CSS file] [--css-dump] [-d] [--debug] [--encoding=character encoding] [-h] [--help] [-q] [--quiet] [--version] [-w] [--warn] [-x] [--xml] [--xhtml] [--html] [SRC] [DEST]


This manual page documents briefly the xhtml2pdf command.

xhtml2pdf is an HTML-to-PDF converter using the ReportLab Toolkit, HTML5lib and pyPdf.

It supports HTML 5 and CSS 2.1 (and some of CSS 3). It is completely written in pure Python so it is platform independent. The main benefit of this tool that a user with Web skills like HTML and CSS is able to generate PDF templates very quickly without learning new technologies. Easy integration into Python frameworks like CherryPy, KID Templating, TurboGears, Django, Zope, Plone, Google AppEngine (GAE) etc.


A summary of options is included below.


Name of a HTML file or a file pattern using * placeholder. If you want to read from stdin use - as file name. You may also load an URL over HTTP. Take care of putting the src in quotes if it contains characters like ?.


Name of the generated PDF file or - if you like to send the result to stdout. Take care that the destination file is not already opened by any other application like the Adobe Reader. If the destination is not writeable a similar name will be calculated automatically.

-b, --base

Specify a base path if input comes via STDIN.

-c, --css

Path to default CSS file


Dumps the default CSS definitions to STDOUT.

-d, --debug

Show debugging information.


The character encoding of SRC. If left empty (default) this information will be extracted from the HTML header data.

-h, --help

Show the help text.

-q, --quiet

Show no messages.


Show version information.

-w, --warn

Show warnings

-x, --xml, --xhtml

Force parsing in XML mode (automatically used if SRC ends with .xml).


Force parsin in HTML mode (default).


xhtml2pdf was written by Dirk Holtwick <<[email protected]>>.

This manual page was written by Toby Smithe <<[email protected]>>, for the Debian project (but may be used by others).