If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
HTML Help files are made with help authoring tools. Microsoft ships the HTML Help Workshop with supported versions of Microsoft Windows and makes the tool available for free download. There are also a lot of third-party help authoring tools available.
CHM files, known as Microsoft Compressed HTML Help files, are a common format for eBooks and online documentation. They are basically a collection of HTML files stored in a compressed archive with the added benefit of an index.
Under Linux, you can view a CHM file with the xchm viewer. But sometimes that’s not enough. Suppose you want to edit, republish, or convert the CHM file into another format such as the Plucker eBook format for viewing on your Palm. To do so, you first need to extract the original HTML files from the CHM archive.
This can be done with the CHMLIB (CHM library) and its included helper application extract_chmLib.
Install Chmlib in Ubuntu
sudo apt-get install libchm-bin
Convert .chm files in to HTML files
If you want to convert .chm files in to HTML files use the following command
extract_chmLib book.chm outdir
where book.chm is the path to your CHM file and outdir is a new directory that will be created to contain the HTML extracted from the CHM file.
Convert .chm files in to PDF files
First you need to install htmldoc. HTML processor that generates indexed HTML, PS, and PDF.HTMLDOC is a program for writing documentation in HTML and producing indexed HTML, PostScript, or PDF output (with tables of contents). It supports most HTML 3.2 and some HTML 4.0 syntax, as well as GIF, JPEG, and PNG images.
sudo apt-get install htmldoc
If you want to use htmldoc type the following command in terminal
htmldoc
Once it opens you should see similar to the following screen here you can choose the html file and convert them to pdf,ps





Wow—I used extract_chmlib on a 19.9MB 1000+ page .chm file and it converted the whole thing in 1.375s!
Great post, I have learned something usefull tonite!
Thank you.
Very useful post!!!
Thanks!
Awesome to know about but how do you make sure it produces a pdf with proper page ordering?
I tried chmlib/htmldoc with disappointing results. Then I found out about the chm2pdf utility and it is found in the Ubuntu repository. This is a command line utility but it works well, no muss or fuss.
sudo apt-get install chm2pdf
chm2pdf –book filename.chm filename.pdf
BTW, I also found out that there are chm readers for Ubuntu. I tried out a couple including xCHM which I think was the best (gnnochm would close unexpectedly).
sudo apt-get install xchm
Then find it in your menu->Applications->Accessories->xCHM
or command line: xchm
I prefer to convert them to pdf though.
I tried both, htmldoc & chm2pdf…. both work fine,
but quality of the output file of chm2pdf seems better than that of htmldoc!!!!
I tried both on a “newer” chm file.
Both barf differently.
htmldoc fails totally, chm2pdf converts but the index/TOC is useless and it complained about some image formats in the file (jpg)
I think all of these are poor tools for a very poor format (chm)
i tried chm2pdf as suggested but it didn’t work, any suggestions?
TypeError: cannot concatenate ’str’ and ‘NoneType’ objects
I tried HTMLDOC, and it was apparently unable to convert any (I tried several different files) .chm files, kept reporting that it was unable to parse
By using chm2pdf, i managed to convert it to pdf. But i also get error “exit value: 45056″, not sure what it is about…..
Tried chm2pdf, worked beautifully without problem.
Very Nice post …very nice program ….thanx