![]() |
#1 |
Member
![]() Posts: 16
Karma: 10
Join Date: Oct 2006
Device: Sony PRS-500
|
Formatting Gutenberg txt Files
This may or may not fit here, but I've been working on macros in OpenOffice.org and Microsoft Office to convert .txt files on Gutenberg to something more readable and "bookmarkable."
Since I'm new at macros and hate programming, I had to use both MS Word and OpenOffice. MS Word is able to insert page breaks at chapter and book headings (which OpenOffice can't, apparently) and doesn't randomly erase swaths of text when running the "End-of-line Remover" macro (which OpenOffice does consistently). The documentation (if I may be allowed to disgrace the name) is therefore somewhat complex but I'm hoping that can be fixed - and I think the end result is well worth the effort. I have it streamlined to five macros. After about 10-20 minutes of fine-tuning, I can have a fully bookmarked, formatted and stylized book ready to read comfortably. I looked around the forums but haven't found anything like what I can make from txt files, so I'd like to post up the macros, the template and the exported PDF I use for the Sony Reader. I imagine that people who know more about the programming side of macros could streamline this a lot better - or get things working completely in OpenOffice.org, at least. If this interests anybody, take it and run with it (or start from scratch and do something much better). Note that the page format for the Sony Reader is 3.57"x4.82 - I don't have mine yet and I picked up these dimensions from somewhere in the past. Thanks everyone, Sam EDIT: New Version 0.3.3 There was a bug in 0.3 that prevented applying the text body style to the entire project before applying heading styles, which made the text font and size inconsistent. Should be fixed now. I know, I know - absolutely no quality control on my part. Here we go, Major changes:
Changes from 0.3
Changes from 0.3.2
It's a bit on the slow side - about three minutes for a 600 page book (formatted for the Sony Reader's screen size) and about ten minutes for an 1800 page book. Anybody got any good ideas I could add to this? Sam Last edited by AnsgarSerif; 10-31-2006 at 02:45 PM. Reason: New version - 0.3.3 |
![]() |
![]() |
![]() |
#2 |
Enthusiast
![]() ![]() Posts: 39
Karma: 173
Join Date: Oct 2006
|
Thanks for your work, I will have a go with these macros tonight
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 230
Karma: 1500
Join Date: Oct 2006
Device: Kobo Clara, Sony PRS950, T1, T2, T3
|
Great idea! Thanks for posting your macros.
FYI, for text or RTF you don't need to format for the Reader's screen size. Just sort out the paragraph ends and the reader with take care of the rest. If there's an HTML file, I'll import that into Word, save it as an RTF, "select all", bump up the primary text to 15 points (via the font "size up" button) change it to Arial font and then save it again. That process keeps any other larger or smaller fonts (chapter heads, for example) in a proportional size. I've got to "macro-ize" that process. Last edited by BobVA; 10-23-2006 at 09:40 PM. |
![]() |
![]() |
![]() |
#4 |
Member
![]() Posts: 16
Karma: 10
Join Date: Oct 2006
Device: Sony PRS-500
|
Bookmark Support In RTF?
Hey, BobVA
I definitely like your idea for HTML files - five minutes and you've got a classic all set to read! Formatting for the screen size is due to my choice of PDF as the final format - I was under the impression that you can't make bookmarks in a RTF file. Since I like to jump to favorite chapters/parts of books (I mean, really, isn't "The Inferno" so much more fun to read after Circle 5?), I thought that bookmark support was pretty important, hence the PDF. You could probably set the bookmarks automatically in a .doc file but I didn't know how to do that. On the other hand, it would be much better to save the final document in a few different formats (RTF, DOC, ODT, PDF and BBeB whenever Sony releases the specs) - that way, there can be something for everyone! Right now, I'm trying to look around for a way to input a dialog box so that the user can input the Author and Title before saving and then use that info to automatically create the file name - any ideas? |
![]() |
![]() |
![]() |
#5 |
Gizmologist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,615
Karma: 929550
Join Date: Jan 2006
Location: Republic of Texas Embassy at Jackson, TN
Device: Pocketbook Touch HD3
|
Nice work, AnsgarSerif! Thanks for sharing the fruits of your labor.
![]() Regarding RTF's & Bookmarks -- you can't set links in an RTF, like in a PDF or BBeB, but you can set bookmarks once you get the text into the Reader or Connect Software. I just wanted to clarify the terminology, as it might confuse new folks. ![]() |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 230
Karma: 1500
Join Date: Oct 2006
Device: Kobo Clara, Sony PRS950, T1, T2, T3
|
Quote:
Here's how I've been doing this for RTF's: - Insert a page break at the start of the chapter in your word processor - Put in a a one or two-character special flag (I use "||", but you can use anything that's not in the text) before the chapter headings. - Save the file - Import the file in Connect and open it. - Use the search command to locate the flag strings and then click the bookmark button. Just takes a few seconds to do this as you can repeat the "find/mark" without having to re-enter the flag characters; i.e. it's just a matter of two mouse clicks per bookmark after the first one. The page break before the chapter starts isn't absolutely necessary, but it makes the bookmark screen on the Reader look a lot tidier. Cheers, Bob |
|
![]() |
![]() |
![]() |
#7 |
Gizmologist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,615
Karma: 929550
Join Date: Jan 2006
Location: Republic of Texas Embassy at Jackson, TN
Device: Pocketbook Touch HD3
|
Nice system, a bit labor intensive, but not too burdensome. Thanks, BobVA!
|
![]() |
![]() |
![]() |
#8 | |
Enthusiast
![]() Posts: 37
Karma: 76
Join Date: Oct 2006
Device: Sony Reader
|
Quote:
-lint |
|
![]() |
![]() |
![]() |
#9 |
Gizmologist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,615
Karma: 929550
Join Date: Jan 2006
Location: Republic of Texas Embassy at Jackson, TN
Device: Pocketbook Touch HD3
|
You have to add the "Grow Font 1 Pt" button to your toolbar -- right click on the toolbar and choose "Customize," then find the tool under the "Format" catagory and drag it to one of your existing toolbars.
![]() |
![]() |
![]() |
![]() |
#10 |
Enthusiast
![]() Posts: 37
Karma: 76
Join Date: Oct 2006
Device: Sony Reader
|
thanks!
![]() |
![]() |
![]() |
![]() |
#11 |
Gizmologist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,615
Karma: 929550
Join Date: Jan 2006
Location: Republic of Texas Embassy at Jackson, TN
Device: Pocketbook Touch HD3
|
You're welcome!
|
![]() |
![]() |
![]() |
#12 |
Recovering Gadget Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,381
Karma: 676161
Join Date: May 2004
Location: Pittsburgh, PA
Device: iPad
|
Another way in MS Word without the button is to select all the text and then hit "Ctrl-Shft >" to increase font size or "Ctrl-Shft <" to reduce it.
|
![]() |
![]() |
![]() |
#13 |
Gizmologist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,615
Karma: 929550
Join Date: Jan 2006
Location: Republic of Texas Embassy at Jackson, TN
Device: Pocketbook Touch HD3
|
Really?!? Now that's news to me, and very welcome news at that! Now I won't have to dig up the button every time I'm on someone else's computer. Thanks, Bob!
|
![]() |
![]() |
![]() |
#14 | |
Addict
![]() ![]() Posts: 285
Karma: 129
Join Date: Sep 2006
Location: New England
Device: PRS-500 · iPad · K3
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#15 |
Member
![]() Posts: 16
Karma: 10
Join Date: Oct 2006
Device: Sony PRS-500
|
Hey everybody,
Thanks for your posts so far! Here's where I'm at right now. I've been getting help on the OpenOffice.org forum by JohnV, who is entirely responsible for providing the code that works around the problem of OpenOffice deleting text after 64K worth of characters. There's still an error that pops up (probably from me guessing what the names of search strings are) but as soon as I get that ironed out, I'll post a new macro. Hopefully, the laborious documentation will get a lot shorter soon. I'm planning to create this macro to output an RTF file as well as a PDF - is there a way you can have the Connect Software search for a specific heading type? That would allow for near-automatic bookmarking with RTFs, I think. These are the ideas that I'd like to incorporate at some later point:
If anybody has any more ideas for this lil' project, let me know! If we can get enough features put into macros, maybe somebody could code a utility that calls soffice.bin as a service and does everything in the background. Thanks all, Sam |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Unable Convert Gutenberg TXT to Mobi | ascherjim | Calibre | 4 | 06-23-2009 08:55 AM |
Text formatting for .txt files | motorhead | HanLin eBook | 9 | 01-08-2009 06:29 PM |
Text tool for formatting Gutenberg text files | bob_ninja | Workshop | 5 | 11-13-2007 12:28 PM |
turning project gutenberg txt files to pdfs | kamyar22 | Sony Reader | 12 | 01-27-2007 08:33 AM |
Formatting looks off on txt and rtf files | Crono | Sony Reader | 25 | 10-27-2006 07:31 PM |