CHM to ePub Converter
Ever since I got my Kindle, I am using it more and more to do all kind of reading electronically. I use Calibre (@ calibre-ebook.com) as my one stop solution to eBook management.
Recently I tried to convert CHM to eBook format, and found that it was rather difficult. Feature rich as it is, Calibre does not have a native CHM conversion function. One can extract the CHM file and feed it to Calibre, but I found it rather tidious and error prone. I also missed having a hierarchical Table of Contents, which are always present in CHM files.
I just went ahead and created a converter for myself in C#.
Here is the sample screenshot.
The application is very simple itself. Select the CHM file for convertion and press convert. That is it. It will dump a ePub file with the same name as the CHM file and in the same folder as the CHM file.
The only other option in the application is a XPath Parameter. I have found that most CHM files are enclosed in Tables, which makes reading on eBook readers a bit inefficient. If the you understand XPath, you can provide a it here to extract only those nodes that match the XPath.
This is what the Application does:
- Convert CHM table of content to ePub table of contents.
- Re-Arranges files into single folder, while maintaining links.
- Convert HTML files to XHTML using tidy.
- Re-Arranges images files with duplicate detection using hash value.
- Remove all Images that are not referenced either in content or CSS.
- Minify CSS file with duplicate detection
- Remove tables that have only one row and one column. It will keep other tables that does not match the criteria.
- Remove width attribute from tables, and from all classes in CSS files.
- And finally, build a ePub File.
Once the file is converted to ePub you can use Calibre to convert to any format that your eBook reader supports.
Pre-Requisites:
- You will need the latest version of 7-zip installed at the default path. If you dont have it, go get it from www.7-zip.org. Make sure you get the x64 version of you are running a 64-bit OS. I will try and remove this dependency in future.
- Windows XP or better.
- .NET 3.5 must be installed. The installer will not check for this.
Download
You can get the application here,
CHM to ePub Converter v 1.0
This is a common installation for both x86 and x64 systems. The installer will automatically detect your system and install correct files for it.
Note
- Even though I have tested this application, I have not tested it extensively. If you find any issues please leave me a comment and I will try and fix the issue in next version. Please keep in mind that this is just a hobby project for me, so I will be supporting it / improving it in my free time.
- You can run the application in debug mode by appending the parameter "/d0". The installer automatically creates a link for this.