Convert CHM to PDF
How to convert CHM to PDF in Linux
1. Install dependencies by running the following command in the terminal:
2. Next, download chm2pdf by clicking here or using wget
3. Now extract the downloaded file.
4. Browse to the folder you extracted and run:
sudo python setup.py install
Now on the command line, type:
chm2pdf examples
Unstructured HTML files inside the CHM file, use of –webpage option – produces my-file.pdf:
Structured HTML files:
Structured HTML files, produce a table of contents page automatically (–title option):
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:
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:
Like above, but name the PDF “your-file.pdf”:
A very interesting option (and one that is not htmldoc-specific, but is pure chm2pdf-specific) is the –extract-only option:
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