Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 10-31-2006, 07:52 PM   #1
igorsk
Wizard
igorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfolded
 
Posts: 3,443
Karma: 52235
Join Date: Sep 2006
Location: Belgium
Device: PRS-500/505/700, Kindle, Cybook Gen3, Words Gear
HTML2LRF

Just a little tool I made using DLLs from the Toolbar for LIBRIe. It's basically a command-line version of the toolbar.

Features:
  1. Supports both fetching remote URLs and local files
  2. Adds a TOC with a link to each page
  3. Embeds pictures
  4. Preserves (some of) formatting

Issues:
  1. Links do not work (yet?)
  2. Error messages (if any) are in Japanese.
Usage:
HTML2LRF [-t "Book title"] [-a "Book Author"] [-o output_filename] <url|path.html> [<url|path.html>...]
Defaults are "Test Book", "Unknown Author", and "test.lrf".

Hints:
  1. Text for TOC entries is taken from the page's <TITLE> tag.
  2. If you want to process local files, make sure you pass a full pathname, or a file:// URL.

Clicky
igorsk is offline   Reply With Quote
Old 10-31-2006, 08:40 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,376
Karma: 4961459
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
cool I'm going to try to get this going under wine as soon as I get some time.
kovidgoyal is online now   Reply With Quote
Old 10-31-2006, 10:30 PM   #3
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 igorsk
Just a little tool I made using DLLs from the Toolbar for LIBRIe. It's basically a command-line version of the toolbar.
You rule, man

Quick question, if Russian fonts installed on the Reader, will russian characters be displayed in LRF?
Slava is offline   Reply With Quote
Old 11-01-2006, 01:03 AM   #4
geekraver
Addict
geekraver can eat soup with a fork.geekraver can eat soup with a fork.geekraver can eat soup with a fork.geekraver can eat soup with a fork.geekraver can eat soup with a fork.geekraver can eat soup with a fork.geekraver can eat soup with a fork.geekraver can eat soup with a fork.geekraver can eat soup with a fork.geekraver can eat soup with a fork.geekraver can eat soup with a fork.
 
Posts: 297
Karma: 9282
Join Date: Jul 2006
Location: Redmond
Device: iPad,Nexus 7,Kobo Glo
Igor, maybe you should mention this in the Content subforum.
geekraver is offline   Reply With Quote
Old 11-01-2006, 02:01 AM   #5
scotty1024
Banned
scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.
 
Posts: 1,300
Karma: 1479
Join Date: Jul 2006
Location: Peoples Republic of Washington
Device: Reader / iPhone / Librie / Kindle
I call this application BBeBook. It is far from perfect/complete in its understanding of LRF, but It is written 100% in Java and needs no dll's from Sony. It is Unicode clean.

It uses a couple public java libraries: xpp3 and jpedal.

It can re-flow HTML and PDF documents into LRF files. It has latent support for rasterizing PDF files into PNG's in the LRF (non-reflow).

It comes with a sample Creative Commons ebook to bind with it: Cory Doctorow's Someone Comes to Town, Someone Leaves Town.

I've GPL'd the tool (not Cory's book), have fun.
Attached Files
File Type: zip BBeBook-0.1.zip (659.3 KB, 7349 views)
scotty1024 is offline   Reply With Quote
Old 11-01-2006, 03:28 AM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,376
Karma: 4961459
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Looks good scotty, though is there a command line interface? I find GUIs really awkward for these kinds of jobs.
kovidgoyal is online now   Reply With Quote
Old 11-01-2006, 08:16 AM   #7
sartori
Connoisseur
sartori began at the beginning.
 
Posts: 54
Karma: 29
Join Date: Oct 2006
Scotty,

Not sure if you noticed the tool lrf2lrs on the librie yahoo group - you can use it to extract lrf's back to lrs source files. Sony didn't encrypt the sample books they provided on the reader - they are just plain lrfs. Using the lrf2lrs tool you can extract most of them (some don't work) and take a look at their construction. It may help with understanding some of the lrf format.

I think the ones that don't work have tags that the librie doesn't use.

Based on the headers it looks like Sony is creating their content using BookCreator.

Rob
sartori is offline   Reply With Quote
Old 11-01-2006, 01:39 PM   #8
porkupan
Fanatic
porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.
 
porkupan's Avatar
 
Posts: 554
Karma: 1057213
Join Date: Sep 2006
Location: North Eastern U.S.
Device: Sony Reader
Quote:
Originally Posted by Slava
Quick question, if Russian fonts installed on the Reader, will russian characters be displayed in LRF?
The answer to this question is: Yes, they will. Tested on Fictionbook HTML. I guess, Sony's library automatically converts the Cyrillic CP1251 into Unicode, which is nice.
porkupan is offline   Reply With Quote
Old 11-02-2006, 05:37 AM   #9
scotty1024
Banned
scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.
 
Posts: 1,300
Karma: 1479
Join Date: Jul 2006
Location: Peoples Republic of Washington
Device: Reader / iPhone / Librie / Kindle
Quote:
Originally Posted by kovidgoyal
Looks good scotty, though is there a command line interface? I find GUIs really awkward for these kinds of jobs.
Yes, it has a command line interface.

It uses an XML file to supply the dublin core data for the book in command line mode. An example of which is included for the example book. The tool knows how to resize a front cover image into the thumbnail to embed into the LRF file as well (one less thing to create yourself.)
scotty1024 is offline   Reply With Quote
Old 11-02-2006, 05:46 AM   #10
scotty1024
Banned
scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.
 
Posts: 1,300
Karma: 1479
Join Date: Jul 2006
Location: Peoples Republic of Washington
Device: Reader / iPhone / Librie / Kindle
Quote:
Originally Posted by sartori
Scotty,

Not sure if you noticed the tool lrf2lrs on the librie yahoo group - you can use it to extract lrf's back to lrs source files. Sony didn't encrypt the sample books they provided on the reader - they are just plain lrfs. Using the lrf2lrs tool you can extract most of them (some don't work) and take a look at their construction. It may help with understanding some of the lrf format.

I think the ones that don't work have tags that the librie doesn't use.

Based on the headers it looks like Sony is creating their content using BookCreator.

Rob
I'm not sure if you noticed but earlier versions of this tool were posted on the Yahoo group by myself. I've also done work on the LRF reverse engineering wiki.

I have my own Java LRF dumper as well.

I've spent much time pulling apart LRF files.

My focus with this tool is in producing re-flowable LRF files. Book Creator, Book Designer focus on page layout oriented books that are more awkward to magnify.

Unfortunately the Sony Reader I ordered opening day, and was only recently delivered, died after 2 hours of operation. It has yet to be replaced. I live in a "dead zone" of local availability, as I live far too close to geekraver to be able to get a local replacement.
scotty1024 is offline   Reply With Quote
Old 11-02-2006, 11:05 AM   #11
porkupan
Fanatic
porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.
 
porkupan's Avatar
 
Posts: 554
Karma: 1057213
Join Date: Sep 2006
Location: North Eastern U.S.
Device: Sony Reader
Quote:
Originally Posted by igorsk
Issues:
  1. Links do not work (yet?)
  2. Error messages (if any) are in Japanese.
Igor,

Actually, the links do appear to work. At least in the fictionbook's HTML files they do work just fine. I guess it may depend on whether the links are "absolute" (full URL) or just "local" (labels). The label links work, the full URLs probably don't. So in theory the file could be pre-parsed to replace the absolute links with randomly generated local ones.

I wonder if Sony provided a way to specify the font size of the book, the genre (right now hardcoded some Japanese word), the line spacing? The font appears kinda a bit small, the margins - kinda a bit too wide, the line spacing is OK, but could be a bit tighter. The book looks nice, though.

Thanks

Last edited by porkupan; 11-02-2006 at 11:07 AM.
porkupan is offline   Reply With Quote
Old 11-02-2006, 11:25 AM   #12
igorsk
Wizard
igorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfolded
 
Posts: 3,443
Karma: 52235
Join Date: Sep 2006
Location: Belgium
Device: PRS-500/505/700, Kindle, Cybook Gen3, Words Gear
The text styles are specified in the "DesignHorizontal.lrf" file. You could try decompiling it with lrf2lrs, adjusting things you need, and compiling back.
As for the genre, it is indeed hardcoded but you can change it with the EditLRFMeta tool.
igorsk is offline   Reply With Quote
Old 11-02-2006, 10:46 PM   #13
porkupan
Fanatic
porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.porkupan ought to be getting tired of karma fortunes by now.
 
porkupan's Avatar
 
Posts: 554
Karma: 1057213
Join Date: Sep 2006
Location: North Eastern U.S.
Device: Sony Reader
For whatever reason the program crashes on some of the HTML files for me. Seems to depend on the size of the file. For instance, this one crashes, but smaller ones don't. Not sure where the limit is, and if it really is the file size that kills it.

BTW, my attempts to decipher the DesignHorisontal.lrf with lrf2lrs were unsuccessful. The scripts unloads with the error message:
Traceback (most recent call last):
File "H:\boroda\HTML2LRF-0.1\bin\lrf2lrs.py", line 1506, in <module>
sys.exit(main(sys.argv[1:]))
File "H:\boroda\HTML2LRF-0.1\bin\lrf2lrs.py", line 1500, in main
out.write(h.toXml());
File "H:\boroda\HTML2LRF-0.1\bin\lrf2lrs.py", line 1480, in toXml
xml += o.toXml(self.objects)
File "H:\boroda\HTML2LRF-0.1\bin\lrf2lrs.py", line 498, in toXml
f = StringIO.StringIO(self.stream)
AttributeError: LRFHeader instance has no attribute 'stream'
porkupan is offline   Reply With Quote
Old 11-02-2006, 11:56 PM   #14
scotty1024
Banned
scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.
 
Posts: 1,300
Karma: 1479
Join Date: Jul 2006
Location: Peoples Republic of Washington
Device: Reader / iPhone / Librie / Kindle
Quote:
Originally Posted by porkupan
For whatever reason the program crashes on some of the HTML files for me. Seems to depend on the size of the file. For instance, this one crashes, but smaller ones don't. Not sure where the limit is, and if it really is the file size that kills it.
I could never get the Librie to eat more than 16MB of LRF. Perhaps the library knows this and cuts you off.
scotty1024 is offline   Reply With Quote
Old 11-03-2006, 08:25 AM   #15
FangornUK
Addict
FangornUK has a complete set of Star Wars action figures.FangornUK has a complete set of Star Wars action figures.FangornUK has a complete set of Star Wars action figures.FangornUK has a complete set of Star Wars action figures.
 
FangornUK's Avatar
 
Posts: 205
Karma: 317
Join Date: Oct 2006
Location: England
Device: Sony PRS-505, iPad, Kindle 3
Scotty1024, perhaps I'm missing something obvious but how do you use your BBeBook software? I don't know much about Java.
FangornUK is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML2LRF and inline pictures pepak Calibre 12 02-04-2009 12:12 PM
chaining web2disk to html2lrf beowulf573 Calibre 2 11-19-2008 04:48 PM
Bookdesigner problem vs. html2lrf alophind Sony Reader 7 02-04-2008 12:20 PM
PRS-500 Need help with Html2Lrf (screen attached) alophind Sony Reader Dev Corner 14 02-01-2008 03:56 AM
html2lrf vs rtf2lrf paspas Sony Reader 0 11-18-2007 02:35 PM


All times are GMT -4. The time now is 04:36 AM.


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