From MobileRead
Jump to: navigation, search

ViCHMethod is a method of converting CHM files to PDF or any supported format. It is written for Linux platforms, but could easily be run on any other platform if alternative tools were to be found (Suggestions from other users would be helpful).


[edit] Necessary tools

[edit] CHM to HTML

Step 1: Prepare chm file
Step 2: Use extract_chmLib
Step 3: Find html files

Using extract_chmLib in terminal, whose syntax is "extract_chmLib chm_file output_directory", decompile chm to html files. Now you have several folders and a lot of files in output_directory. Find the folder that holds many .html files and maybe images folder.

[edit] Filtering HTML

Step 4: Sort files
Step 5: Rename files
Step 6: Confirm renaming completion

Open all those .html files with KRename and open Files tab. Sort files in order that you want them to appear in PDF ( You can check what those files contain by opening them in internet browser ). Then open Filename tab and change Template to ### in first input line and html in second line. Then press Finish.

[edit] Uniting all HTMLs

Step 7: Place uniter.cpp to the same folder
Step 8: Execute my source code
Step 9: Find created html file

Now it's time to use my source code. Put in the same folder that holds all of those HTML files and run terminal from that folder with command "g++ uniter.cpp -o unite". This should have created a program called "unite" which you can now run from the same terminal with "./unite". If everything went well, then you should have another new file called "book.html" in your folder.

[edit] Creating PDF

Step 10: Open html file with
Step 11: Export it as PDF
Step 12: Choose location for PDF
Step 13: at work
Step 14: All done! PDF in place

Open that "book.html" file with Word Processor and use "File -> Export as PDF...", change nothing and press "Export". Then choose the destination for your PDF and press "Save". Wait until Word Processor finishes saving and you're done! You have a PDF from CHM file that you can easily transfer to your e-reader.

Method created by Vinillum, 2010; Contact: vinillum at micro dot lt

Personal tools

MobileRead Networks