ePub Reader App

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Contact:

ePub Reader App

Post by endernafi » Mon Dec 17, 2012 4:10 pm

Hello Dear LiveCoders,

I need to code an app in which a book can be read in ePub format.
Actually, it should be a part of a greater app.
Think this as coding iBooks all over again with LiveCode, well, maybe a simpler version 8)
Can this be done in LiveCode or via an external, plugin, etc.?

Could someone please direct me to the right way?


Best,

~ Ender Nafi
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: ePub Reader App

Post by Mark » Mon Dec 17, 2012 4:56 pm

Hi Ender,

You can try this: add the itunes.apple.com URL, the same you can find in iTunes when browsing the BookStore on the Mac, but replace http with itms-books

Code: Select all

launch url "itms-books://itunes.apple.com/de/book/marchen/id436945766"
or

Code: Select all

launch url  "itms-books://itunes.apple.com/WebObjects/MZStore.woa/wa/viewMultiRoom?fcId=510054265&s=143443"
If the book has been downloaded already, it should just open in iBooks.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Contact:

Re: ePub Reader App

Post by endernafi » Mon Dec 17, 2012 5:02 pm

Hi Mark,

Thanks for the tip.
But, shouldn't I provide in the launch url command the filepath of my book
so that iBooks can figure out which book the user want to read?


Best,

~ Ender Nafi
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: ePub Reader App

Post by Mark » Mon Dec 17, 2012 5:18 pm

Hi Ender,

Sorry, I forgot that this is about ePubs that are not in iTunes. I think you can load a book into iBooks by launching its URL, which can also be a file path in the shared folder. You can't launch files that are in the documents folder of your app for instance. Once you have loaded the ePub, you probably need an external to retrieve the code that you need to open it again in iBooks.

I don't know of a way to actually display an ePub file in a LiveCode window.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

SoapDog
Posts: 84
Joined: Sun Apr 09, 2006 10:03 pm
Contact:

Re: ePub Reader App

Post by SoapDog » Thu Jan 10, 2013 2:51 pm

Hello Ender,

This is much more difficult than it seams. An ePub file is a zip file with a bunch of HTML, XML, CSS and images in it. It follows a predefined format that is very flexible and to build it you need to be able to layout and render an HTML/CSS file. Unfortunately plain LiveCode can't handle this kind of thing. You can however use a webview native control to render the HTML/CSS. You can use an open source project such as monocle or octobook to render your assets but to do this you will need advanced knowledge of both LiveCode and HTML/CSS/JS and the EPUB specs.

What you will do is use LiveCode to rewrite the HTML files on the fly inserting/injecting code into it to do the whole page fliping rendering thing. Basically you are generating HTML on the fly based on the contents of the EPUB file. Then you open a webview and tell it to load your processed stuff.

I don't think this is an easy project. I built two EPUB readers but not as mobile applications, as web applications powered by LiveCodeServer and believe me, its quite hard to get it working well specially if you don't have control over the EPUB generation process.

If you need more information on EPUB spec, I recommend Elizabeth Castro books.

Best
andre
http://www.andregarzia.com

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Contact:

Re: ePub Reader App

Post by endernafi » Thu Jan 10, 2013 5:13 pm

Andre, you're awesome 8)

It's obvious that it won't be easy but i think it's worth to effort.
I hope I'll handle it.

Thanks a bunch for your great help and for the clarification of the process...


Best,

~ Ender Nafi
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

Post Reply