Ubuntu Linux: Convert CHM file into PDF file
CHM (Microsoft Compiled HTML Help) is a Microsoft proprietary online help format, that consists of a collection of HTML pages and an index.
CHM files are not recognized by Linux and they cannot be open using any default application.
To open CHM files, you have to install CHM viewer in Linux.
In my previous article, I have written about CHM viewer for Linux.
This articles shows how to convert CHM file into PDF file. You can convert CHM files to PDF files with the help of a simple Python script calleed chm2pdf.
Here is the command to install chm2pdf in Ubuntu Linux:-
sudo apt-get install chm2pdf
chm2pdf (–book / –webpage) [options] input_filename [output_filename]
Note: Either ‘–book’ or ‘–webpage’ MUST be given! Only one of the two options can be present, not both!
Suppose, I have a CHM file named Mukesh-Chapagain.chm
Now, to convert it into PDF format, I will use the following command:-
If there are unstructured HTML files inside the CHM file then I will use:-
chm2pdf –webpage Mukesh-Chapagain.chm
If there are structured HTML files inside the CHM file then I will use:-
chm2pdf –book Mukesh-Chapagain.chm
A new PDF file named Mukesh-Chapagain.pdf is created after I run the above command.
Hope it helps. Thanks.