Friday, December 11, 2009

How to Convert chm files to HTML or PDF files

SkyHi @ Friday, December 11, 2009
Microsoft Compiled HTML Help is a proprietary format for online help files, developed by Microsoft and first released in 1997 as a successor to the Microsoft WinHelp format. It was first introduced with the release of Windows 98, and is still supported and distributed through Windows XP platforms.

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


Once it opens you should see similar to the following screen here you can choose the html file and convert them to pdf,ps

You need to install xchm, which will read chm files. (chm files are Microsoft help files.) To install xchm, open a terminal and type:

sudo apt-get install xchm