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-25-2006, 09:48 PM   #16
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
Quote:
Originally Posted by Slava
That is why, one has to read documentation
Sacrilege!
NatCh is offline   Reply With Quote
Old 10-26-2006, 04:08 AM   #17
AnsgarSerif
Member
AnsgarSerif began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Oct 2006
Device: Sony PRS-500
Here it is, version 0.2!

Aside from everything being in one macro (unless you really wanted chapter page-breaks), the only thing that's really new is that the macro outputs a RTF file and a PDF file onto the desktop. Everything being in one macro is pretty big, though!

I'm indebted to John Vigor, who gave me a great bit of code that made everything possible - everyone give him props if he ever comes over here from the OOo forum! Thanks to him, we've now got a single macro that needs to be run to convert .txt files into something readable and bookmark-able. There are still quite a few things that would make this even better - but I think I'll take a day off first

If anybody wants to run this and leave some feedback (or instructions on how to put page breaks into an OOo macro!), I'd love to hear from ya. The documentation is much more fluid now, mostly just explaining what everything does and including a few pictures to help those who don't often use OpenOffice.org.

Thanks, everyone - now I can finally go to bed!

Sam

EDIT: The newest version is available on the first post.

Last edited by AnsgarSerif; 10-27-2006 at 02:28 AM. Reason: New version posted on first post
AnsgarSerif is offline   Reply With Quote
Advert
Old 10-26-2006, 02:41 PM   #18
AnsgarSerif
Member
AnsgarSerif began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Oct 2006
Device: Sony PRS-500
A quick note:

I just realized that opening the outputted RTF file in Word, running the Page_Break macro and re-opening it in OpenOffice will change all the headings and prevent the exported PDF file from marking any bookmarks.

You can prevent this by inserting the RTF as a file:

1) Finish the Page_Break macro and close the file
2) Open the Project Gutenberg Conversion Template.ott file to create a new document
3) Goto Insert > File ... and select the RTF

This will convert Word headings to the proper OpenOffice headings and preserve bookmarking capability in RTF. I've uploaded the new template file, since the one from last night was saved as a document, not a template. Sorry about that - I guess the mind starts to dwindle after 2 AM. Everything besides the file type is exactly the same.

Sam

EDIT: The newest version is available on the first post.

Last edited by AnsgarSerif; 10-27-2006 at 02:27 AM. Reason: New version posted on first post
AnsgarSerif is offline   Reply With Quote
Old 10-26-2006, 11:33 PM   #19
njt
Enthusiast
njt began at the beginning.
 
Posts: 37
Karma: 14
Join Date: Oct 2006
Quote:
Originally Posted by AnsgarSerif
A quick note:

I just realized that opening the outputted RTF file in Word, running the Page_Break macro and re-opening it in OpenOffice will change all the headings and prevent the exported PDF file from marking any bookmarks.

You can prevent this by inserting the RTF as a file:

1) Finish the Page_Break macro and close the file
2) Open the Project Gutenberg Conversion Template.ott file to create a new document
3) Goto Insert > File ... and select the RTF

This will convert Word headings to the proper OpenOffice headings and preserve bookmarking capability in RTF. I've uploaded the new template file, since the one from last night was saved as a document, not a template. Sorry about that - I guess the mind starts to dwindle after 2 AM. Everything besides the file type is exactly the same.

Sam
I'd like to say that this is a very nice macro you did and it does help quite a bit I've been able to format a book in just a few minutes. The thing is, I'm a bit confused on this area
Quote:
You can set the title to “Title,” the by-line to “Byline,” the author to “Author” – you see where this is going. If there are sub-chapter titles, I like to give them a style like “Subtitle” or “Sony Reader – Chapter Heading 3” and then go to Tools > Outline Numbering and change the drop-down boxes to reflect the applied style. This is so that, when you export the document to PDF, the sub-chapter titles will appear as a sub-bookmark of the chapter.
(sorry for not being able to figure it out, I just don't want to change something and have it end up doing something weird .)

Also, I tried the new macro in word for page breaks and well it did "break the page" so to speak. It ended up cutting the first few pages in half and not doing much else for the rest of the book (could you post up an example of something you've converted using your macro and what a final product should look like? This way I can know I'm doing things right.) Thanks again for all the hard work you've put into this. I for one appreciate it .
njt is offline   Reply With Quote
Old 10-27-2006, 12:06 AM   #20
AnsgarSerif
Member
AnsgarSerif began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Oct 2006
Device: Sony PRS-500
njt,

Sorry that the Word macro broke the document - I tested it once (on the same document I recorded the macro on - big mistake) at around 2 in the morning. The GOOD news is that there was a really simple way to insert the page breaks in OpenOffice. I just had to format the chapter and book styles properly. I've included author and document headers that are automatically populated and I'm working on cleaning the code right now and then implementing an automatic file name. As soon as I get that done, I'll post up a new template. Everything's in one macro set now!

All of the styles that I use are in the "Styles and Formatting" window under the category "Custom Styles." You can modify the styles as you see fit (changing the font and size and what-not) without doing any damage. I'll attach a PDF with the different styles as they'd look in a document - basically, you can use the styles to fine-tune things like subtitles and sub-chapter headings to make the text look better.

Right now, the PDF bookmarks are exported in this tree:
  1. Sony Reader - Title
  2. Sony Reader - Book Heading
  3. Sony Reader - Chapter Heading 1
  4. Sony Reader - Chapter Heading 2

This will create a primary bookmark using the Title, a sub-bookmark using the Book Headings (Like in "Moby Dick," where there are multiple "books") and a sub-bookmark of that using Chapter Heading 1. If you want to change the way the PDF bookmarks, you can go to Tools > Outline Numbering and select the style you want bookmarked from the drop-down box. Personally, I sometimes like to bookmark the lines I've styled "Sony Reader - Chapter Heading 3" to show up in the bookmark, as well (like the journal entries in "Dracula" or the sections of Locke's "Two Treatises on Government").

I hope that answered your question and I'll do my best to have the new macro up before I go to bed tonight. I've attached Locke's "Two Treatises on Government" and that should give you an idea of how the PDF bookmark tree looks - by adjusting the styles in Tools > Outline Numbering, you can fine-tune the document you're working on to your liking. Let me know if you had a different meaning than I've understood.

Thanks!

Sam
Attached Files
File Type: pdf Locke, Two Treaties of Government.pdf (814.1 KB, 393 views)
AnsgarSerif is offline   Reply With Quote
Advert
Old 10-27-2006, 02:19 AM   #21
AnsgarSerif
Member
AnsgarSerif began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Oct 2006
Device: Sony PRS-500
Here we go,

Major changes:
  • 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

The instructions are updated and sample files are included. Hopefully, this is full-featured enough to qualify as a frequently usable macro. 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.

I've posted the new attachment up on my edited first post. Let me know what you think!

Sam
AnsgarSerif is offline   Reply With Quote
Old 10-27-2006, 11:52 AM   #22
njt
Enthusiast
njt began at the beginning.
 
Posts: 37
Karma: 14
Join Date: Oct 2006
Quote:
Originally Posted by AnsgarSerif
Here we go,

Major changes:
  • 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

The instructions are updated and sample files are included. Hopefully, this is full-featured enough to qualify as a frequently usable macro. 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.

I've posted the new attachment up on my edited first post. Let me know what you think!

Sam
I have to say once again I'm very impressed!! This got me thinking, would this macro work for just about any text? I mean a lot of people have been wondering how to convert files into nice looking rtf/PDFs and what not, and well this could solve that problem^^;

The only thing that I'm not fully understanding now is, the whole "Book mark" thing for the pdf. I had to manually change things around for it to export and have the book marks there right. Is that what you had to do as well?
njt is offline   Reply With Quote
Old 10-27-2006, 12:49 PM   #23
AnsgarSerif
Member
AnsgarSerif began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Oct 2006
Device: Sony PRS-500
njt,

Thanks! I don't think that this macro, in it's entirety, would work with a .doc or HTML file, since it'd probably start deleting line breaks that it shouldn't and foul everything up - it should be possible to start the process somewhere later along the line (say the HeadingStyles macro) and have a finished product that looks the same as a .txt conversion. I'll try it out later today.

Could you run a .txt file through the macro and then upload the .txt file, the .odt file and the .pdf file so I can see why the PDF bookmarking isn't working for you? Or do you get the bookmarks to show up on the computer but not the Sony Reader? If that's the case, then please let me know how I can change the program to make it right - I don't have my Reader yet, so I'm pretty much shooting from the hip with my eyes closed as to how it will display.

Note that if you've got a book structure that doesn't use the word "Book" or "Chapter" to separate different parts of the book, you're not likely to see chapter headings automatically applied - a good example is "Treasure Island," which uses "Parts" as books- since "Part" is not uncommon at the beginning of a normal sentence, I didn't include it in the macro - you have to set these to "Book Heading" yourself. To use "Treasure Island" again, none of the chapters have the "Chapter" label - it's just 1, 2, 3 ... you have to go through and manually adjust those, too.

I've uploaded (or will in five minutes time) a new .zip file, since I erased a function that converted the whole text to "Sony Reader - Text Body" before applying Heading Styles - that's why the text doesn't look consistent sometimes. The template is the only thing I changed, so I'll add it to this post. Sorry about that!

Sam
Attached Files
File Type: zip Project Gutenberg Conversion Template.zip (14.1 KB, 363 views)
AnsgarSerif is offline   Reply With Quote
Old 10-27-2006, 08:29 PM   #24
njt
Enthusiast
njt began at the beginning.
 
Posts: 37
Karma: 14
Join Date: Oct 2006
Quote:
Originally Posted by AnsgarSerif
njt,

Thanks! I don't think that this macro, in it's entirety, would work with a .doc or HTML file, since it'd probably start deleting line breaks that it shouldn't and foul everything up - it should be possible to start the process somewhere later along the line (say the HeadingStyles macro) and have a finished product that looks the same as a .txt conversion. I'll try it out later today.

Could you run a .txt file through the macro and then upload the .txt file, the .odt file and the .pdf file so I can see why the PDF bookmarking isn't working for you? Or do you get the bookmarks to show up on the computer but not the Sony Reader? If that's the case, then please let me know how I can change the program to make it right - I don't have my Reader yet, so I'm pretty much shooting from the hip with my eyes closed as to how it will display.

Note that if you've got a book structure that doesn't use the word "Book" or "Chapter" to separate different parts of the book, you're not likely to see chapter headings automatically applied - a good example is "Treasure Island," which uses "Parts" as books- since "Part" is not uncommon at the beginning of a normal sentence, I didn't include it in the macro - you have to set these to "Book Heading" yourself. To use "Treasure Island" again, none of the chapters have the "Chapter" label - it's just 1, 2, 3 ... you have to go through and manually adjust those, too.

I've uploaded (or will in five minutes time) a new .zip file, since I erased a function that converted the whole text to "Sony Reader - Text Body" before applying Heading Styles - that's why the text doesn't look consistent sometimes. The template is the only thing I changed, so I'll add it to this post. Sorry about that!

Sam
Thanks for the new version. I'll be sure to try it out later tonight. As for you not having one yet, that makes sense now. The font at which you have it right now is quite quite small. (I changed mine to arial 11 bold) which works quite well .

In regards to the html/ doc comment, what I meant was, they could convert those to txt and just convert again using this macro from there. Unless the html/doc had some fancy formatting this would probably produce a better looking book. Just my thought on that .

As for the bookmarks, I just realized why. The books I was testing this out on were Sherlock and the time machine. Neither have chapters in the way you describe thus the need for manually editing.

Anyways, off to work! I'll try this later tonight.

Last edited by njt; 10-27-2006 at 08:31 PM.
njt is offline   Reply With Quote
Old 10-27-2006, 09:13 PM   #25
AnsgarSerif
Member
AnsgarSerif began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Oct 2006
Device: Sony PRS-500
Ahhh!

I don't know why this didn't happen before but apparently there's a loop in the code, so the macro never finishes. Honestly, I tested the dang thing and it finished fine earlier. Lucifer's been touching my stuff again, it seems.

Anyhow, here's the new file (and the whole package has been updated in the first post). I changed the Text Body font to Garamond 13 pt. (I'm sorry, I just really really hate Arial - if you have Calibri, that's the money font).

I guess this is why it takes so long to get a new version of Windows to the public, eh?

Sam
Attached Files
File Type: zip Project Gutenberg Conversion Template 0.3.3.zip (14.5 KB, 405 views)

Last edited by AnsgarSerif; 10-31-2006 at 02:47 PM. Reason: New version - 0.3.3
AnsgarSerif is offline   Reply With Quote
Old 10-31-2006, 05:47 PM   #26
kukafei
Member
kukafei has a spectacular aura aboutkukafei has a spectacular aura aboutkukafei has a spectacular aura aboutkukafei has a spectacular aura aboutkukafei has a spectacular aura aboutkukafei has a spectacular aura aboutkukafei has a spectacular aura aboutkukafei has a spectacular aura aboutkukafei has a spectacular aura aboutkukafei has a spectacular aura aboutkukafei has a spectacular aura about
 
Posts: 24
Karma: 4158
Join Date: Oct 2006
Device: Sony Reader PRS-600, Kindle DX
Sam,

I tried your tool and it works great. The only problem is that the PDF output is blank starting at page 1000 and page turns get really slow (several seconds) later on. The same thing happened with custom PDF's I printed from manybooks.net, but it seems to be a problem with the files and not the reader as someone else made a large PDF file that works fine (see this post https://www.mobileread.com/forums/sho...4984#post44984 ).
kukafei is offline   Reply With Quote
Old 10-31-2006, 06:35 PM   #27
AnsgarSerif
Member
AnsgarSerif began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Oct 2006
Device: Sony PRS-500
kukafei,

I'll play around with it tonight - thanks for the heads up!

I'll work on Tolstoy's "War and Peace" and upload a couple of different PDFs based on different software configurations (both in OOo and Adobe Acrobat). Let's hope that we don't have to add Acrobat to the necessary software, eh?

Sam
AnsgarSerif is offline   Reply With Quote
Old 11-01-2006, 01:01 PM   #28
Thanlis
Junior Member
Thanlis began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Nov 2006
Device: Sony Reader
Hm. This is erroring out for me. Here's what happens:

I imported the macros as per the instructions. I close OpenOffice. I open up a new document, and run the Begin_Here macro.

It gets to the ChangeEmptyParaStyle macro, and errors out with:

BASIC runtime error.
An exception occured
Type: com.sun.star.lang.IllegalArgumentException
Message: .

This is a new OpenOffice installation, version 2.0.4.
Thanlis is offline   Reply With Quote
Old 11-01-2006, 01:36 PM   #29
AnsgarSerif
Member
AnsgarSerif began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Oct 2006
Device: Sony PRS-500
Thanlis,

I've recreated the error. Did you open a new document from the template or did you try to open a document by clicking on the "OpenOffice.org Writer" button?

The reason for my question is this: the styles I've set up won't automatically transfer over to the program itself - they're embedded in the template file. If you want to import them into the program, then you have to create a new default template. You can do this by importing the styles - there is a drop-down box on the top-right of the "Styles and Formatting" window named "New Style from Selection." Choose "Load Styles" and select the "Project Gutenberg Conversion Template" file. Then save the document as a template somewhere permanent (My Documents, for example) and then choose that as a default template from "File > Templates > Organize ..." by right-clicking on the "My Templates" folder and importing your new document then right-clicking the filename and choose "Use as my default template."

I like to have a header on every document I make, so that I can insert page numbers or my name without messing up the pagination later down the road; you can change pretty much anything you like on the file before you save it as a template - if you, for instance, want a different style or font as your default, change it before you save the template.

So, in short, the macro won't work without the new styles I created in the template. You either need to use the "Project Gutenberg Conversion Template" (which you can alter anything you need to, page size, font, styles, and re-save as a template file) or import the Sony Reader styles into your default template.

Sorry about the hassle; let me know what features you'd like to see when you get it working!

Sam
AnsgarSerif is offline   Reply With Quote
Old 11-01-2006, 03:01 PM   #30
Thanlis
Junior Member
Thanlis began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Nov 2006
Device: Sony Reader
It works like a charm now. Thanks! And I love the formatting it produces, so I'm happy as a clam.
Thanlis 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 06:18 PM.


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