Extract and decompile .chm file to view as html file under Linux

by Vivek Gite · 3 comments

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

Featured Articles:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 3 comments… read them below or add one }

1 Binny V A 01.23.07 at 2:47 am

If possible try to use a CHM view rather than viewing it this way. In most viewers, you can search through the text – which is the main advantage of CHM files.

2 unni kartha 10.14.09 at 4:09 pm

gnochm works fine for me. debian lenny gnu/linux

3 sh!zeeg 11.14.09 at 3:16 pm

Yay! Cool! Now I can read my CHMs in plaintext tty too! Elinks, lynx, w3m, conkeror. In any of my favorite browsers!
Thank you very much.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post:

Next post: