How to convert CHM files into PDF files in Ubuntu
Posted by admin on June 27th, 2008
Email This Post
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
Install chm2pdf in ubuntu
sudo aptitude install chm2pdf
Using chm2pdf
chm2pdf syntax
/usr/bin/chm2pdf [options] input_filename [output_filename]
chm2pdf examples
Unstructured HTML files inside the CHM file, use of --webpage option - produces my-file.pdf:
chm2pdf --webpage my-file.chm
Structured HTML files:
chm2pdf --book my-file.chm
Structured HTML files, produce a table of contents page automatically (--title option):
chm2pdf --book --title my-file.chm
Structured HTML files, produce a table of contents page automatically (--title option), add a “titlepage” as found in the toc.html file inside the CHM:
chm2pdf --book --title --titlefile toc.html my-file.chm
If the file “toc.html” is not found, a warning will be issued and the option will be ignored - just browse the (very verbose) output of chm2pdf to see that warning if you suspect you mispelled the titlefile name.
Like above, now with an explicitly set page size and maximum compression level for the resulting PDF:
chm2pdf --book --title --titlefile toc.html --size 177.8×233.3mm --compression 9 my-file.chm
Like above, but name the PDF “your-file.pdf”:
chm2pdf --book --title --titlefile toc.html --size 177.8×233.3mm --compression 9 my-file.chm your-file.pdf
A very interesting option (and one that is not htmldoc-specific, but is pure chm2pdf-specific) is the --extract-only option:
chm2pdf --extract-only my-file.chm
will extract the contents of my-file.chm (all the HTML and other, “special”, files inside the CHM) into the directory CHM2PDF_TEMP_ORIG_DIR/my-file. Thus, if CHM2PDF_TEMP_ORIG_DIR has its default value “/tmp/chm2pdf/orig”, chm2pdf will extract the file into /tmp/chm2pdf/orig/my-file and stop. You can then examine the extracted files at your pace. They will be overwritten next time you call chm2pdf with the same file(name).
If you want to know more available options use the following command from your terminal
chm2pdf --help



June 27th, 2008 at 3:02 am
YES!
A million thanks to whoever packaged this for Ubuntu/Debian!
June 27th, 2008 at 11:11 pm
I have Ubuntu 7.10, and the ch2pdf package doesn’t exists, The solution? Easy:
First install this packages:
sudo aptitude install libchm-bin libchm-dev htmldoc python-chm
Second
Download de chm2pdf script on this site: http://code.google.com/p/chm2pdf/
Thanks for the tip
July 3rd, 2008 at 6:38 pm
great help man.
thnx.
with your permission, can I post the link of this webpage in my blog?
July 3rd, 2008 at 7:33 pm
yes you can post the source link
July 4th, 2008 at 6:15 pm
thnx.