http://madphilosopher.ca/2006/09/how-to-convert-chm-files-under-linux/
How to convert CHM files under Linux
September 24th, 2006
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.
In Debian or Ubuntu:
$ sudo apt-get install libchm-bin
$ 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.
In other Linuxes, you can install it from source. First download the libchm source archive from the above website. I couldn’t get the extract_chmLib utility to compile under the latest version 0.38, so I used version 0.35 instead.
$ tar xzf chmlib-0.35.tgz
$ cd chmlib-0.35/
$ ./configure
$ make
$ make install
$ make examples
After doing the “make examples“, you will have an executable extract_chmLib in your current directory. Here is an example of running the command with no arguments and the output it produces:
$ ./extract_chmLib
usage: ./extract_chmLib <chmfile> <outdir>
After running the utility to extract the HTML files from your CHM file, the extracted files will appear in <outdir>. There won’t be an “index.html” file, unfortunately. So you’ll have to inspect the filenames and/or their contents to find the appropriate main page or Table of Contents.
Now the HTML is yours to enjoy!
==================================================================
Extract and decompile .chm file to view as html file under Linux
http://www.cyberciti.biz/tips/decompile-chm-file-to-view-as-html.html
You can view .chm file using gnochm or kchmviewer under Linux. However sometime you cannot install these programs. There is a third alternative - arCHMage.
From the man page:
arCHMage is an extensible reader and decompiler for files in the CHM format. This is the format used by Microsoft HTML Help, and is also known as Compiled HTML. arCHMage is based on python-chm binding to chmlib from GnoCHM project.
It allows you extract .chm to directory.
Step # 1: Use apt-get command
If you are using Debian / Ubuntu, type the command:
# apt-get install archmage
Step # 2: Extract .chm to directory (directory will be created):
Type the command:
$ archmage file.chm output
Open your browser and type url file:///home/you/output or file:///home/you/output/index.html
Other usage
You can view chm file using inbuilt http-server.
View chm file using Webserver
You can run archmage as http-server, which will publish chm file contents on specified port:
# archmage -p 8888 /path/to/file.chm &
Open a browser and type ulr http://localhost:8888/ or http://server-ip:8888/
Force apache to publish chm files
You can force Apache to publish chm file contents if there is trailing slash in request to that file. First make sure you have working mod_python. Now open httpd.conf /apache2.conf file:
# vi httpd.conf
Add following lines to your httpd.conf:
AddHandler python-program .chm
PythonHandler archmod.mod_chm
Save and close the file. Restart apache.
# /etc/init.d/httpd restart
Now upload file.chm to document root of your Apache webserver. Now view file by typing URL: http://you.com/file.chm/
Note: trailing slash at the end of URL.
Download arCHMage
=> Download arCHMage
https://sourceforge.net/project/showfiles.php?group_id=84745