How to Convert chm files to HTML or PDF files

Sponsored Link
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

htmldoc

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

Sponsored Link

Incoming search terms:

Related posts

29 thoughts on “How to Convert chm files to HTML or PDF files

  1. Wow—I used extract_chmlib on a 19.9MB 1000+ page .chm file and it converted the whole thing in 1.375s!

    [Reply]

  2. I tried chmlib/htmldoc with disappointing results. Then I found out about the chm2pdf utility and it is found in the Ubuntu repository. This is a command line utility but it works well, no muss or fuss.

    sudo apt-get install chm2pdf
    chm2pdf –book filename.chm filename.pdf

    [Reply]

  3. BTW, I also found out that there are chm readers for Ubuntu. I tried out a couple including xCHM which I think was the best (gnnochm would close unexpectedly).

    sudo apt-get install xchm

    Then find it in your menu->Applications->Accessories->xCHM

    or command line: xchm

    I prefer to convert them to pdf though.

    [Reply]

    kiran Reply:

    Super it worked :)..Cheers

    [Reply]

    ally nambandi Reply:

    How do you convert a chm to pdf if one have open it with xhcm?

    [Reply]

  4. I tried both, htmldoc & chm2pdf…. both work fine,
    but quality of the output file of chm2pdf seems better than that of htmldoc!!!!

    [Reply]

  5. I tried both on a “newer” chm file.
    Both barf differently.
    htmldoc fails totally, chm2pdf converts but the index/TOC is useless and it complained about some image formats in the file (jpg)

    I think all of these are poor tools for a very poor format (chm)

    [Reply]

  6. i tried chm2pdf as suggested but it didn’t work, any suggestions?
    TypeError: cannot concatenate ‘str’ and ‘NoneType’ objects

    [Reply]

  7. I reckon chm2pdf should be named promiseware.The results you receive can be different to what you expect and its definitely there to be broken….

    It doesn’t cope well with long filenames. –continuous was the option that worked for me to finally create a pdf, but the formatting was TOTALLY messed up – one word per line. Not good for a book!!!

    Good thing I dual boot with Vista!!! Nice article, but maybe a lot has changed since it was written in ’07.

    [Reply]

  8. hi, it’s really a nice tool.
    But in chm file, I can do global research,
    is there any way to do this work in html?
    Now the only method is use “index” and search.

    Best Regards,
    robert

    [Reply]

  9. I tried both converters htmldoc and chm2pdf, unfortunately none of these worked. I have very large books and received the following error –

    ERR002: Error: no pages generated!
    exit value: 256

    [Reply]

  10. thanks for the tip. I managed to generate the pdf.
    If possible please also include steps to use the htmldoc software

    [Reply]

  11. you can view chm file by installing kchmviewer
    And you can install it by typing this command in command prompt (sudo apt-get install kchmviewer)
    I tried it, it is really osum.

    [Reply]

Leave a comment

Your email address will not be published. Required fields are marked *