Simple CHM to PDF conversion on Linux

Published on 2010-01-07.

This is nothing new, but if you ever needed a simple way to convert a document from CHM format into PDF format on Linux, here's an easy way to do it with a fairly good result.

You need to make sure that chmlib and htmldoc is installed.

On Debian you can get them with:

# apt-get install libchm-bin htmldoc

Next, extract the contents from the CHM file:

$ extract_chmlib doc.chm DESTINATION

Where DESTINATION is the destination directory. If the directory doesn't exist, it will be created.

In order to create a single PDF file of size A4 you can use the following command:

$ htmldoc --size a4 --webpage -f doc.pdf DESTINATION/*.html

That's it.