jimmyzou
05-10-2007, 09:05 PM
I have some files in CHM format, how to convert it into LRF?
|
View Full Version : How to deal with CHM? jimmyzou 05-10-2007, 09:05 PM I have some files in CHM format, how to convert it into LRF? igorsk 05-10-2007, 09:13 PM In the command prompt execute: hh -decompile <path to .chm> <directory where to put html files> Then just convert the html files using BookDesigner or html2lrf. You can also use one of the hundreds of fancy CHM decompilers to get the HTML. jimmyzou 05-10-2007, 11:55 PM Thanks, igorsk. Seems I need really take time to learn how to use BD.... HarryT 05-11-2007, 03:08 AM On a related note, do you (or anyone else) know of any good way to create an LRF file from a "collection" of HTML files - ie the sort of document where (for example) one has a book that consists of a "Contents" page which has links to each chapter; each chapter being a separate HTML file? AndyQ 05-11-2007, 03:54 AM Well, there is a program HTMLDoc which can convert multiple html pages into a PDF which you could then convert to an LRF. The current versions of HTMLDoc are shareware but an older version (which is freeware) can be found at http://fresh.t-systems-sfr.com/pc/src/www/old/ HarryT 05-11-2007, 05:01 AM Thanks for the suggestion Andy. I'm really not a fan of PDF. Anyone know of anything which will convert to some more "friendly" format such as a single HMTL page? RTF? kacir 05-11-2007, 06:33 AM On a related note, do you (or anyone else) know of any good way to create an LRF file from a "collection" of HTML files - ie the sort of document where (for example) one has a book that consists of a "Contents" page which has links to each chapter; each chapter being a separate HTML file? I usually take the index.html (TOC) file and edit it so only the list of files that are referenced is retained- all in perfect order. This can be done like this load file in vim editor remove all linebreaks :%s/\n// insert linebreaks before all < characters :%s/</{here press ctrl+Q Enter}</g insert linebreaks after all > characters :%s/>/>{here press ctrl+Q Enter}/g remove all lines not containing <a href= tag :v/<a href/delete remove all <a href="http:// tags themselves :%s/<a href=" remove all > tags :%s/">// You can even make script file strip_names.vim " beginning of the script :%s/\n// :%s/</{here press ctrl+Q Enter}</g :%s/>/>{here press ctrl+Q Enter}/g :v/<a href/delete :%s/<a href=" :%s/">// " end of the script and you call the script by typing :source strip_names.vim on the commandline of the Vim editor Then I take this list and convert it to a script like cat chapter1.html >> all_of_them.html cat chapter2.html >> all_of_them.html and run the script as an alternative the script all_of_them.vim can look like :$read chapter1.html :$read chapter2.html then you open an empty file all_of_them.html in Vim and run the script :source all_of_them.vim Now you transform resulting monster html document all_of_them.html to rtf by loading it into your favourite word processor and saving it into rtf or using html2rtf, or by running a vim script that converts chosen html tags to rtf tags and inserts an rtf "header" and "footer" - this way you can retain bold and itallic tags and nuke all others Then you can procede to transform rtf file into lrf using your favourite tools. I usually do not bother converting and load rtf file directly into Reader via memory card. For Vim editor for your favourite operating system (including QNX, AmigaOS or VMS among numerous others) see www.vim.org Azayzel 05-11-2007, 09:23 AM In the command prompt execute: hh -decompile <path to .chm> <directory where to put html files> Then just convert the html files using BookDesigner or html2lrf. You can also use one of the hundreds of fancy CHM decompilers to get the HTML. I had no idea BD could do this, that's friggin awesome! Thanks for the command line parameters. I've been using my PDA for viewing CHM's up until now,guess I'll have to give it a go and see how they turn out. My intial thought experiments on this had me running the CHM through a decompiler and then converting the HTML, but I thought I'd have to fish one up myself, guess I was wrong. Thanks again for the info igorsk! jimmyzou 05-11-2007, 12:20 PM I usually take the index.html (TOC) file and edit it so only the list of files that are referenced is retained- all in perfect order. This can be done like this load file in vim editor remove all linebreaks :%s/\n// insert linebreaks before all < characters :%s/</{here press ctrl+Q Enter}</g insert linebreaks after all > characters :%s/>/>{here press ctrl+Q Enter}/g remove all lines not containing <a href= tag :v/<a href/delete remove all <a href="http:// tags themselves :%s/<a href=" remove all > tags :%s/">// ........... Thanks a lot... Wow, it is really like lot of work... Especailly for a people like me, I really have not been doing programing for many years, so these kinda too complex for me... kovidgoyal 05-11-2007, 01:34 PM On a related note, do you (or anyone else) know of any good way to create an LRF file from a "collection" of HTML files - ie the sort of document where (for example) one has a book that consists of a "Contents" page which has links to each chapter; each chapter being a separate HTML file? html2lrf kacir 05-12-2007, 04:32 AM Thanks a lot... Wow, it is really like lot of work... Especailly for a people like me, I really have not been doing programing for many years, so these kinda too complex for me... Vim has relatively steep learning curve, but it is well worth learning. Those commands DO look cryptic, I know, but you should give it a try. Download gvim - a gui version of vim. The most used command in my examples is :s That is just a short form of :substitute command For replacing 'foo' with 'bar' on the current line it works like this: you press <Esc> key to get into command line. Command line is at the bottom of the screen and begins with ':' then you type :substitute/foo/bar/ If you want to substitute 'foo' with 'bar' on all lines of file you have to give he substitute command an address. You could type "apply the substitute command on lines in range from line 1 [represented by number 1] to the last line [you do not know how many lines the file has, so the representation for the last line is $ character]" Uf. That is a loooong command isn't it? We would write it like this press <Esc> to get to the command line and type :1,$substitute/foo/bar/g 1,$ - means range of all lines and there is a shortcut '%', so you do not have to type three characters '1,$' to write the most commonly used range . Also substitute can be shortened to just s command so we get: :%s/foo/bar/g Now we get to the letter 'g' at the end of the substitute command. g is the "option" and it means "replace all occurences of 'foo' on the line". Without 'g' option the substitute command would only replace the first 'foo' on the line. Uffff. And we haven't even scratched the surface yet. I didn't even get to the 'Regular expressions' yet. 'foo' in our example is a regular expression meaning letters 'f' 'o' 'o'. but regular expressions can be MUCH more ... aehm ... expressive see http://www.regular-expressions.info/ Regular expressions in vim are even more powerfull than REs on perl. Yes, I can prove it. Just send me a PM ;-) This all is only a tip of the iceberg. besides the :substitute command there are another 1152 commands in vim (yes, I have just counted them in the ':help index' built in documentation) and another 211 built-in functions. Combine THAT with thousands of macros, programs, scripts, tips, configurations and syntax definition files on www.vim.org PLUS a very very friendly community on the mailing list and you get THE most powerfull text editor in the world. vim also has the best documentation I have *ever* seen. And I am quite keen on software manuals ;-) You do not have to learn all of these commands. Just :s comand itself makes vim worth learning. All you really need is about 10 commands and you can manipulate ANY book in text format to suit your taste. if you learn Vim you will also automaticaly acquire other skills: - you will be able to use the infamous vi editor. vi is the default editor on just about any Unix out there. There are countless other editors but vi is the one you find installed on ANY Unix out there - you will be able to use ed editor - a most minimalistic unix editor you get as the last resort when something really, really bad happens to your Unix (like you screw your /etc/fstab file and your Unix (or Linux, FreeBSD) boots into emergency single user mode - you will be able to write sed scripts - you will be able to use grep command in Unix - you will learn 'Regular expressions' - a really powerfull mini language for manipulating (or describing) strings (text objects) Regular expressions are built into most of the Unix tools (vi, ed, ex, sed, grep, more, less and countless others like for example OpenOffice.org). Regular expressions are built into most of modern programming languages like perl, python, ruby, ..... If you are a Windows user and you hesitate to start using such a complicated and intimidating looking tool as gvim try TextPad - a shareware text editor that has very decent Regular expessions support. Or try EditPad pro http://www.regular-expressions.info/editpadpro.html Disclaimer: This is not a flamebait to the [X]Emacs users ;-) I am a converted former XEmacs user myself. jimmyzou 05-12-2007, 12:24 PM Wow, Kacir, thank yo uvery much for writing that lot. Unfortunately or Fortunately, I' m a windows user, so I will try TextPad and Editpad Pro... I ever used Ultraedit years ago, is this one also comparablely good? kacir 05-13-2007, 07:51 AM Wow, Kacir, thank yo uvery much for writing that lot. Unfortunately or Fortunately, I' m a windows user, so I will try TextPad and Editpad Pro... I ever used Ultraedit years ago, is this one also comparablely good? I have been Windows user since Windows 2.0 version. I use windows at work even now. I need it to run Autocad, CorelDraw and other programs. I am also administrator at the company I work for, so I am a kind of mercenary. I use anything that will get the work done. Windows, Unix, Linux, ... whatever. I even teach MS Office occasionaly ;-) Choice of operating system, or an editor (here I make fun of Vi versus Emacs war) is not a religion. You simply use what works the best for YOU and what you can afford to pay for (or persuade your boss to buy for you). I have been using TextPad for many, many years. It is a great editor, packed to the gills with very powerfull features. It also has a very shallow learning curve and suports decent subset of Regular expressions. It is shareware, but it does not expire and has no disabled features (or used to have, I haven't used TextPad for a intensive work for a few years). I have started using GVim on windows (www.vim.org) only after my skills with Regular expressions grew, and I discovered limits of TextPad. So I do recommand TextPad as the first choice. I also recommand EditPad pro Because the site http://www.regular-expressions.info recommands it, and their Tutorial is THE best tutorial about RE I have ever seen. And I am quite keen on REs as you might have noticed ;-) I am always on the hunt for even better text editor and over the years I have tried many, many editors. If you like UltraEdit, use it. It is one of the best editors out there and it does support regular expressions (that is a very, very powerfull features for "search and replace" function) But first of all go to http://www.regular-expressions.info/tutorial.html and get *inspired*. You can do incredible things with text files with a few clever commands in a powerfull text editor. The most important thing is to get the tool you are comfortable with and start playing. RWood 05-13-2007, 09:33 AM Wow, Kacir, thank yo uvery much for writing that lot. Unfortunately or Fortunately, I' m a windows user, so I will try TextPad and Editpad Pro... I ever used Ultraedit years ago, is this one also comparablely good? I have programmed for many years on all sizes of machines from micros (only since 1979) to large IBM mainframe clusters and almost everything in between and I have never found a better text editor than UltraEdit. astra 05-13-2007, 10:35 AM In the command prompt execute: hh -decompile <path to .chm> <directory where to put html files> Then just convert the html files using BookDesigner or html2lrf. You can also use one of the hundreds of fancy CHM decompilers to get the HTML. Doesn't work. What do I do wrong? RWood 05-13-2007, 04:08 PM Doesn't work. What do I do wrong? You are not alone. I just tried it and I achieved the same results as you. igorsk 05-13-2007, 08:23 PM Sorry, my mistake. It should be the other way around: hh -decompile <folder> <file.chm> astra 05-14-2007, 03:23 AM Sorry, my mistake. It should be the other way around: hh -decompile <folder> <file.chm> Thanks :) yvanleterrible 05-14-2007, 07:59 AM On a related note, do you (or anyone else) know of any good way to create an LRF file from a "collection" of HTML files - ie the sort of document where (for example) one has a book that consists of a "Contents" page which has links to each chapter; each chapter being a separate HTML file? There is a batch conversion Wizard in Word that will help to bring HTML to whatever format you wish from their choices. From that you bring them to LRF using your favorite app. The thing is very quick. I've used it for .TXT and a 100ish documents were converted to RTF in less than 5 mins. Look it up in the help files. UncleDuke 05-14-2007, 08:52 AM i deal with chm by ignoring or deleting them awkward little things that they are dasoulseeker 07-19-2007, 06:16 AM Although tedious. I convert my programming CHM books to pdf with "CHM to PDF converter" which I then plug into Rasterfarian for some split page love. The result is very readable though, and (almost)all the formatting are kept. |