Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Sony Reader

Notices

Reply
 
Thread Tools Search this Thread
Old 10-23-2006, 02:54 AM   #1
AnsgarSerif
Member
AnsgarSerif began at the beginning.
 
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:
  • One macro to convert text (as opposed to five)
  • Everything (including page breaks) runs in OpenOffice.org
  • User prompt for Author, Title
  • Author, Title inserted in page headers
  • Separate macros for saving to RTF and PDF

Changes from 0.3
  • Primary text changed to Garamond 13
  • Primary text consistency bug fixed
  • Fixed infinite loop bug

Changes from 0.3.2
  • Page size changed to 5.24" x 6.69", since more people seemed to prefer that on the forums
  • Chapter Headings 2 and 3 no longer have a page break inserted before them (Sorry about that)

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
AnsgarSerif is offline   Reply With Quote
Old 10-23-2006, 03:44 AM   #2
ChrisAllenFiz
Enthusiast
ChrisAllenFiz doesn't litterChrisAllenFiz doesn't litter
 
Posts: 39
Karma: 173
Join Date: Oct 2006
Thanks for your work, I will have a go with these macros tonight
ChrisAllenFiz is offline   Reply With Quote
Advert
Old 10-23-2006, 09:34 PM   #3
BobVA
Addict
BobVA once ate a cherry pie in a record 7 seconds.BobVA once ate a cherry pie in a record 7 seconds.BobVA once ate a cherry pie in a record 7 seconds.BobVA once ate a cherry pie in a record 7 seconds.BobVA once ate a cherry pie in a record 7 seconds.BobVA once ate a cherry pie in a record 7 seconds.BobVA once ate a cherry pie in a record 7 seconds.BobVA once ate a cherry pie in a record 7 seconds.BobVA once ate a cherry pie in a record 7 seconds.BobVA once ate a cherry pie in a record 7 seconds.BobVA once ate a cherry pie in a record 7 seconds.
 
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.
BobVA is offline   Reply With Quote
Old 10-23-2006, 10:41 PM   #4
AnsgarSerif
Member
AnsgarSerif began at the beginning.
 
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?
AnsgarSerif is offline   Reply With Quote
Old 10-24-2006, 11:05 AM   #5
NatCh
Gizmologist
NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.
 
NatCh's Avatar
 
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.
NatCh is offline   Reply With Quote
Advert
Old 10-24-2006, 10:18 PM   #6
BobVA
Addict
BobVA once ate a cherry pie in a record 7 seconds.BobVA once ate a cherry pie in a record 7 seconds.BobVA once ate a cherry pie in a record 7 seconds.BobVA once ate a cherry pie in a record 7 seconds.BobVA once ate a cherry pie in a record 7 seconds.BobVA once ate a cherry pie in a record 7 seconds.BobVA once ate a cherry pie in a record 7 seconds.BobVA once ate a cherry pie in a record 7 seconds.BobVA once ate a cherry pie in a record 7 seconds.BobVA once ate a cherry pie in a record 7 seconds.BobVA once ate a cherry pie in a record 7 seconds.
 
Posts: 230
Karma: 1500
Join Date: Oct 2006
Device: Kobo Clara, Sony PRS950, T1, T2, T3
Quote:
Originally Posted by NatCh
..., 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.

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
BobVA is offline   Reply With Quote
Old 10-25-2006, 12:22 AM   #7
NatCh
Gizmologist
NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.
 
NatCh's Avatar
 
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!
NatCh is offline   Reply With Quote
Old 10-25-2006, 01:36 PM   #8
lint
Enthusiast
lint has learned how to buy an e-book online
 
Posts: 37
Karma: 76
Join Date: Oct 2006
Device: Sony Reader
Quote:
bump up the primary text to 15 points (via the font "size up" button)
Ive been looking for how to do this in WORD, but can't find it. Any tips would be appreciated. thanks!

-lint
lint is offline   Reply With Quote
Old 10-25-2006, 01:43 PM   #9
NatCh
Gizmologist
NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.
 
NatCh's Avatar
 
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.
Attached Thumbnails
Click image for larger version

Name:	Grow Font 1 Pt tool.png
Views:	753
Size:	9.0 KB
ID:	1989  
NatCh is offline   Reply With Quote
Old 10-25-2006, 02:20 PM   #10
lint
Enthusiast
lint has learned how to buy an e-book online
 
Posts: 37
Karma: 76
Join Date: Oct 2006
Device: Sony Reader
thanks!
lint is offline   Reply With Quote
Old 10-25-2006, 02:27 PM   #11
NatCh
Gizmologist
NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.
 
NatCh's Avatar
 
Posts: 11,615
Karma: 929550
Join Date: Jan 2006
Location: Republic of Texas Embassy at Jackson, TN
Device: Pocketbook Touch HD3
You're welcome!
NatCh is offline   Reply With Quote
Old 10-25-2006, 04:48 PM   #12
Bob Russell
Recovering Gadget Addict
Bob Russell ought to be getting tired of karma fortunes by now.Bob Russell ought to be getting tired of karma fortunes by now.Bob Russell ought to be getting tired of karma fortunes by now.Bob Russell ought to be getting tired of karma fortunes by now.Bob Russell ought to be getting tired of karma fortunes by now.Bob Russell ought to be getting tired of karma fortunes by now.Bob Russell ought to be getting tired of karma fortunes by now.Bob Russell ought to be getting tired of karma fortunes by now.Bob Russell ought to be getting tired of karma fortunes by now.Bob Russell ought to be getting tired of karma fortunes by now.Bob Russell ought to be getting tired of karma fortunes by now.
 
Bob Russell's Avatar
 
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.
Bob Russell is offline   Reply With Quote
Old 10-25-2006, 05:01 PM   #13
NatCh
Gizmologist
NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.NatCh ought to be getting tired of karma fortunes by now.
 
NatCh's Avatar
 
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!
NatCh is offline   Reply With Quote
Old 10-25-2006, 07:28 PM   #14
Slava
Addict
Slava doesn't litterSlava doesn't litter
 
Slava's Avatar
 
Posts: 285
Karma: 129
Join Date: Sep 2006
Location: New England
Device: PRS-500 · iPad · K3
Quote:
Originally Posted by NatCh
Really?!? Now that's news to me, and very welcome news at that!
That is why, one has to read documentation
Slava is offline   Reply With Quote
Old 10-25-2006, 08:04 PM   #15
AnsgarSerif
Member
AnsgarSerif began at the beginning.
 
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:
  • User Prompt for Title, Author
  • Automatically save file name as Author, Title
  • Save in RTF, DOC, HTML, PDF and BBeb (eventually) with bookmarks for all supported documents
  • Format page based on user prompt (for PDF output to Sony Reader, iREX Iliad, Amazon Kindle or whatever)
  • Author and Title in Header (Is this already available in Sony Reader?)
  • User prompt for font, size

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
AnsgarSerif is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 07:32 PM.


MobileRead.com is a privately owned, operated and funded community.