Install the packages
sudo apt-get install chm2pdf python-beautifulsoup
Convert the CHM file to PDF
chm2pdf --webpage --beautifulsoup filename.chm
You can even change colour, font, and margin of the generated PDF file. For more information on how to do so, please invokeman chm2pdf
command on the terminal.