What's new? | Help | Directory | Sign in
Google
chm2pdf
A script that converts CHM files into PDF files
  
  
  
  
    
Search
for
Updated Dec 03, 2007 by devicerandom
Labels: Featured
HowToUse  
Usage of chm2pdf

Usage:

/usr/bin/chm2pdf (--book / --webpage) [options] input_filename [output_filename]

Either '--book' or '--webpage' MUST be given! Only one of the two options can be present, not both!

chm2pdf supports most command line htmldoc options. For a full summary usage, type chm2pdf --help at the command line.

PLEASE DO NOT POLLUTE THIS WIKI PAGE WITH COMMENTS If you have trouble using chm2pdf, use the Google group instead.


Comment by nick.hristov, Sep 21, 2007

Do not forget to use the --enable-examples on chmLib, otherwise this script will throw a bunch of exceptions, and will fail.

If you have a mac, and you use darwin ports (port on the cmdline), be aware that the chmlib will NOT be built with this option. You can, however, separately download chmlib and build it yourself with this option, install it, and then re-run the script.

Comment by pietervandewyngaerde, Sep 29, 2007

make sure you have python-chm bindings installed !!!

or you get an error like

File "/usr/bin/chm2pdf", line 11, in <module>
import chm.chm as chm
ImportError?: No module named chm.chm

Comment by segolas.elfo.eroe.leggenda, Oct 25, 2007

On my ubuntu Feisty this is what I obtain:

Traceback (most recent call last):

File "/usr/bin/chm2pdf", line 176, in <module>
main(sys.argv)
File "/usr/bin/chm2pdf", line 172, in main
convert_to_pdf(cfile, filename, outputfilename)
File "/usr/bin/chm2pdf", line 106, in convert_to_pdf
pf=open(page_filename,'r')
IOError: 2? No such file or directory: '../tempout//final/toc.html'

think the error is in the last line, that double slash "//".

I try to fix it but still got the same... it seems it don't create the tempout directory :-(

Comment by pperevalov, Oct 27, 2007

On Ubuntu box if you are getting following error

OError: 2? No such file or directory: '../tempout//final/toc.html' and chm2pdf complaains about libchm.so.0 run the command below:

sudo ln -s /usr/local/lib/libchm.so.0 /usr/lib/libchm.so.0

Comment by henry.jules.poincare, Nov 06, 2007

START-QUOTE

On my ubuntu Feisty this is what I obtain:

Traceback (most recent call last):

File "/usr/bin/chm2pdf", line 176, in <module>
main(sys.argv)
File "/usr/bin/chm2pdf", line 172, in main
convert_to_pdf(cfile, filename, outputfilename)
File "/usr/bin/chm2pdf", line 106, in convert_to_pdf
pf=open(page_filename,'r')

IOError: 2? No such file or directory: '../tempout//final/toc.html'

think the error is in the last line, that double slash "//".

I try to fix it but still got the same... it seems it don't create the tempout directory :-(

END-QUOTE

Me too. I obtain the same error on Suse 10.1

Comment by henry.jules.poincare, Nov 06, 2007

I have done sudo ln -s /usr/local/lib/libchm.so.0 /usr/lib/libchm.so.0 but the situation is unchanged. Anyway, chm2pdf doesn't complains about libchm.so.0 .

Quilos did you solved the problem '../tempout//final/toc.html' ?

Comment by blubouy, Nov 06, 2007

On Ubuntu, open the chm2pdf.py file using your favourite editor and search for or scroll down to the

    #concatenation

Section and change the code to

    print 'Concatenating '+str(c)+' individual PDF files...'
    os.system("pdftk *.pdf cat output "+outputfilename)

Re run the setup and It Works like a charm ;)

Comment by henry.jules.poincare, Nov 06, 2007

To bluboy. On Suse, this doesn't solve my problem.

Comment by Halil.Senusija, Nov 13, 2007

I ve got this in the last line:

IOError: 2? No such file or directory: '../tempout//./HTML/pic1.jpg'

Comment by manuel.por.aca, Nov 19, 2007

Please make chm2pdf inform you when the commands enum_chmLib and htmldoc are not available.

I've got "IOError: No such file or directory" because enum_chmLib wasn't in the system. Before installing libchm-dev it finished printing "Done" at the end, but no pdf was there, because htmldoc wasn't found. After installing htmldoc all was fine.

Comment by docsat, Dec 04, 2007

On Opensuse 10.3, I installed chm2pdf and chmlib (from source with --enable-example), pychm (I extract the tarball in /) and htmldoc (from suse repository), but it appers:

# chm2pdf Traceback (most recent call last):

File "/usr/local/bin/chm2pdf", line 24, in <module>
import chm.chm as chm
ImportError?: No module named chm.chm

Thanks

Comment by chenhj98, May 07, 2008

On ubuntu7, I got HTMLDOC window, when I click the button 'Generate', it prompts "No HTML files to format, cannot generate document". Can anyone tell me what is wrong?

Thanks

Comment by fredrik.kronhamn, Jun 27, 2008

I'm on Ubuntu Gutsy 7.10. Followed the nice walkthrough for Ubuntu and managed to convert a 1000+ pages CHM correctly. However subsequent conversions all failed with "no pages generated", but next line says "Written file blah.pdf". Tried to remove /tmp/chm2pdf before conversion - no luck. Also the script cannot parse filenames with blanks even when specified like so: "filename with blank.chm"


Sign in to add a comment