fedefrappi / AePubReader

Another ePub Reader for iPad
-
369 stars 150 forks source link

Book marks and some issue fixed #5

Closed WebberLai closed 12 years ago

WebberLai commented 12 years ago

Hi , Thanks your epub reader ,Can you release book marks function ??

I use your sample to read epub in my iphone project

and I change some code for read more different epub books

  1. EPub.m

In this method is use to find NCX file path , I ONLY use this discriminant to search NCX

} And remark others if statement , works fine so far .

  1. EPubViewController.m

The picture books need add more CSS rule

[webView stringByEvaluatingJavaScriptFromString:setImageRule];

3.Add page curl

actually I use some tricky step to implement page curl effect

In EPubViewController.h add < UIGestureRecognizerDelegate >

In EPubViewController.m

Now it will have a page curl effect when you swipe your finger on screen.

monish152 commented 12 years ago

Hi, Thanks for this update. Its really awesome. You have mentioned bookmark feature but you didnt post code. If you please post it. And I want to chnge text in Georgia font how I can do it please suggest.

WebberLai commented 12 years ago

@monish152 Sorry , I didn't know how to implement bookmarks , that's why I hope @fedefrappi can release book mark function

And change font is not too hard to find answer , just add CSS rule

Check this http://stackoverflow.com/questions/449773/iphone-development-setting-uiwebview-font

monish152 commented 12 years ago

Hi Thanks for reply. Ok I will work on bookmark function. And for font . I want to change index font but I am unable to get that page.

fedefrappi commented 12 years ago

Hi there! First of all I'd like to thank WebberLai for his work on this code, I'll commit your changes as soon as I'll find some free time. We are not working anymore on this code so I'm sorry but I can't implement the bookmark functionality. Anyway I'll be happy to integrate it as well if any of you will manage to implement that. I suggest you to look at how the search was implemented: you will probably need to implement something similar to that if you want to navigate to a certain word inside the whole epub. If you just want to bookmark a whole page, saving the chapter index and page index should be enough.

WebberLai commented 12 years ago

Hi , @fedefrappi , Thank you for your suggestion , I think book mark is just only record current page has been marked is enough . But about this function I have a question , If I zoom the text font in size 20 , the book pages will be more than size 12.

So ...Which one is the real page number ? I think if I know this answer , I can do book mark function .

Or @monish152 can help me to create this function : )

monish152 commented 12 years ago

Hi all, yes I am working on similar functionality like ibook. When I will complete I will post the code. I am facing a problem I am not able to change font of title.

fedefrappi commented 12 years ago

hi @WebberLai, your question shows that just bookmarking "a page" is tricky since there isn't a correspondence between pages as the font size changes: what you call a "page" at size 20 doesn't exist at size 12. Maybe you could solve the problem assuming (for instance) that what you are bookmarking is actually the page that contains the first sentence you are seeing when the user adds a bookmark, this way you could perform a search and use its result to get the page number you want. @monish152: if you want to change the looks of the index you should use a custom UITableViewCell for the index table ;)

WebberLai commented 12 years ago

@fedefrappi Hi all , sorry for my English , I mean in text size 12 I mark a page number , and the total pages are 100 , But if I zoom the text size to 20 , The total page maybe will become 120 pages , How do I know which page is marked ? And maybe use the first sentence to search in books can work . @monish152 I'm do the same thing like you do , create a iBook reader .Hop you can help me to finish it : ) The next problem I can imagine is two page books , I think the new page controller can do this . But before the Chinese new year , I have no time ... If you need my epub reader , send me a mail , fendercustomshop@msn.com

fedefrappi commented 12 years ago

Yes that's exactly the problem I was referring to: when you change the font size what was 1 page actually becomes 2 or multiple pages can be merged into 1. You need to update dynamically the bookmark page index, and to do so I think that searching for a whole bunch of text (the more the merrier, to avoid multiple results) may be a good choice ;)

Soniya-Iphonedev commented 12 years ago

Thank you sir for your valuable code. I am working on bookmark, Highlighting text, and making sticky notes to it at the same time I am working on curl animation and the 1 page and 2 page book view like in ibook

For Highlighting and bookmark i am creating a local database on which I will save these but my problem is same as with WebberLai sir i.e Page index as it changes w.r.t the font size.

Any suggestion will help me to work fast.

I will put my code as soon as I complete these works

eric0815 commented 12 years ago

I implemented bookmark function by saving the font size at the same time;

page curl is hard for me..but some one has already done it here:

http://itunes.apple.com/cn/app//id488571562?mt=8

this app used aepubreader too.

WebberLai commented 12 years ago

Happy Chinese new year to everyone ! I found an interesting kit , but not sure it is a reader or something ...

http://www.binpress.com/app/ipad-ebook-starter-kit/681

Soniya-Iphonedev commented 12 years ago

WebberLai and yufengts can you give your email id so that I can send you the code I m working on. I can put code here as it has not completed yet.

The Problem is with bookmarks, notes and highlight

I try to make book curl effect using UIPageViewController. I create a demo project with array to learn how it works which work fine as we all want but when I integrate it with epub it not give expected output.

I am sending code to fedefrappi sir as well to please give a look in it.

WebberLai commented 12 years ago

@Soniya-Iphonedev fendercustomshop@msn.com , This is my mail , I'm not sure I can help you or not , I'm working on parse the epub file , I found some book's content.opf can't read , I will post solution when I figure it out ,and thank you so much : )

By the way , If you are add the image adjust css rule , it will cause the page count not correct .

But if you don't adjust the image size , the picture will become unreadable !!! : (

Any idea ??

Soniya-Iphonedev commented 12 years ago

@yufengts Sir can you send me the logic or sample code on bookmark as i tried the same by saving font size but still it not show the expected result. (my email id is soniya.iphonedev@gmail.com)

@WebberLai : I have completed with the 1 page and 2 page curl effect using UIPageViewController. 1 page works fine but 2 page not bind correct data. Soon I will send you the code

and sorry I didnt use Css rule for image yet

WebberLai commented 12 years ago

This now I working on 

Why can't I see this commend on the issue discussion ???

Can you reply again ...


寄件者: isakvan reply@reply.github.com 收件者: WebberLai sendercustom@yahoo.com.tw 寄件日期: 2012/2/3 (週五) 12:09 AM 主旨: Re: [AePubReader] Book marks and some issue fixed (#5)

Hi all, first thanks to author for nice free code! I'm using it.

If it correct that this code no supply href to another xml file (<'a href='section-0801.xml'>Look Here<'/a>).

How to do it? Thank you.


Reply to this email directly or view it on GitHub: https://github.com/fedefrappi/AePubReader/issues/5#issuecomment-3780525

eric0815 commented 12 years ago

@Soniya-Iphonedev sorry for the delay. Here is the bookmark function in my project ,

/////////////////////////////////////////////////////////////////////////////

WebberLai commented 12 years ago

@yufengts you are so great : ) Thanks I have a question is it save the book mark data in a plist file will be better ?

I mean one book pair to a plist file .and can you list all the bookmark in a table view

when select the row ,It will jump the page with bookmark ???

Soniya-Iphonedev commented 12 years ago

@WebberLai : I am saving bookmarks in database with currentSpineIndex, currentPageInSpineIndex. Retrive all values from your plist and save in NSMutableArray (since we keep more than 1 value for 1 bookmark, create dictionary for that so that you can retrieve them by using key-value pair). And bind this array to table. On selecting a row retrieve the dictionary at that index in array, and then retrieve currentSpineIndex, currentPageInSpineIndex by its key then call [epubviewcontroller loadSpine:spineIndex atPageIndex:pageIndex highlightSearchResult:nil];

You can give option to delete in table by deleting that particular row item from array and plist(update).

Soniya-Iphonedev commented 12 years ago

Has any one made logic for highlighting like ibook which user can view whenever he comes to that page IF any1 can help me out in it

WebberLai commented 12 years ago

https://bitbucket.org/iosDevClub/basicreaderforiphone/downloads

I upload this iphone version reader , If it helps , just download it : )

Also I remove some method , Like search , I will add it back .

also I add a vfr PDF reader inside .......

eric0815 commented 12 years ago

@WebberLai I add a bookTag and get all bookmarks from nsuserdefaults like:

NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
self.bookmarkList = [NSMutableArray arrayWithArray:[prefs objectForKey:[NSString stringWithFormat:@"bookmarks_%d",self.bookTag]]];

It's better to save the time when bookmark added,but I have not found a good way to implement this. Maybe storing the bookmark into database would be a good idea.

Thanks for sharing your code.

RenugaDevi commented 12 years ago

Hi All,

The application is very helpful to me and updates on the issues too..

First i really thankful to u all who made such a great work.

I'm having small issues in that ,

.epub having pictures(if it's a picture book)means images getting cut at the bottom remaining part of the images shown in the next page

WebberLai mentioned the below code for picture book,

(void)webViewDidFinishLoad:(UIWebView *)theWebView {

NSString setImageRule = [NSString stringWithFormat:@"addCSSRule('img', 'max-width: %fpx; height:auto;')", webView.frame.size.width 0.75];

[webView stringByEvaluatingJavaScriptFromString:setImageRule]; }

but the above code didn't do anything. Please anyone tell me how to avoid image cut.

Thank you

WebberLai commented 12 years ago

@RenugaDevi Did you adjust the pic frame height ???

My code is adjust image width , set height auto size .

Hope this helps you .

RenugaDevi commented 12 years ago

@WebberLai : Thank you for your quick response

No i'm not adjusting the height of the image

NSString setImageRule = [NSString stringWithFormat:@"addCSSRule('img', 'max-width: %fpx; height:auto;')", webView.frame.size.width 0.75];

[webView stringByEvaluatingJavaScriptFromString:setImageRule];

}

in the above code should i want to adjust webview height?

What all are the classes i need to include the code only in EPubViewController.m or anything else?

Please explain me as clear as possible

Note:

The image size is always more than the height of the ipad.

Thank You

WebberLai commented 12 years ago

NSString setImageRule = [NSString stringWithFormat:@"addCSSRule('img', 'max-width: %fpx; height:%fpx;')", webView.frame.size.width 0.75,webView.frame.size.height * 0.5];

Can you try this code ???

RenugaDevi commented 12 years ago

@WebberLai :Yes, i tried that one but, there is no change..

What all are the classes i need to include the code only in EPubViewController.m or any other classes too..

WebberLai commented 12 years ago

can you mail me your sample epub file ? I need to see what's in the OPF file . my mail is sendercustom at yahoo.com.tw .

RenugaDevi commented 12 years ago

@WebberLai : sendercustom@yahoo.com

your mail id is correct ah?

RenugaDevi commented 12 years ago

Have you saw my mail. i sent you the .epub file that i'm using(with images). In that, i'm using your code

same problem again (image getting cut at the bottom and remaining image shown in the next page)

Please check my .epub file with your code

RenugaDevi commented 12 years ago

@WebberLai :saw your mail. Recent code posted by you also not working

void)webViewDidFinishLoad:(UIWebView _)theWebView{ : NSString_setImageRule = [NSStringstringWithFormat:@"addCSSRule('img', 'max-width: %fpx; height: %fpx;')", self.webView.frame.size.width_0.75,self.webView.frame.size.height_0.75]; [webViewstringByEvaluatingJavaScriptFromString:setImageRule]; : }

Please just refer my .epub file

RenugaDevi commented 12 years ago

No, please send me your sample project again with different name

RenugaDevi commented 12 years ago

@WebberLai :Thank u..thaank u so much for your great help.now images are not getting cut but,it's shown in the left corner of the page . Is that possible to show the image in center . Displaying text is as usual ..

Thank you

RenugaDevi commented 12 years ago

@WebberLai :I found another problem that is, i'm using the code

[NSStringstringWithFormat:@"addCSSRule('img', 'max-width: %fpx; height: %fpx;')", self.webView.frame.size.width_0.75,self.webView.frame.size.height_0.75]; [webViewstringByEvaluatingJavaScriptFromString:setImageRule];

to avoid image getting cut. Now image getting cut problem is solved. But the only problem is, if the image is too small means image getting stretch(with that code). Please guide me to solve that.

I'm really struggle with this problem..How can i check the image size based on that i will try to change this code

[NSStringstringWithFormat:@"addCSSRule('img', 'max-width: %fpx; height: %fpx;')", self.webView.frame.size.width_0.75,self.webView.frame.size.height_0.75]; [webViewstringByEvaluatingJavaScriptFromString:setImageRule];

to set webView width and height...

Thank you

WebberLai commented 12 years ago

OK , finally I found a good way to record bookmark , But I only got the idea , I don't have code implement ...

First , You need to get every paragraph

, and give it a tag , for example , the current page is page 35

There are paragraph 100~110 in that page , click the bookmark button , record the (100 - 1) paragraph as a bookmark index

You might think that's strange , but it make sense , because the top of the current page's paragraph could be previous page's last paragraph ,If you skip the paragraph , you will feel strange , why can't I found the last part I read ???

If you read the previous paragraph , you can skip to last part you read , people can remember the previous things ,So it make sense.

jdpecson commented 12 years ago

Thank you @WebberLai for this brilliant code work! I'm now trying your bookmark idea.

WebberLai commented 12 years ago

@jdpecson Wow ! please mail me if you finish this function : )

WebberLai commented 12 years ago

Hmm.... I thank you know what that mean ...

LoveIphone commented 12 years ago

Hello everybody I am starting to create a epub reader and able to read it and also make 1 page and 2 page animation using pagecontroller like in ibook. can any one suggest me how to implement highlights on it. Right now i am using javascript but sometimes it works fine and sometimes not.

Any idea will be appreciated

jdpecson commented 12 years ago

@WebberLai your welcome! As of now, I'm having a hard time getting the element using document.elementFromPosition(x,y) a javascript method. Have any ideas why is it not returning any values?

WebberLai commented 12 years ago

I don't know why my reader only works on simulator ...

jdpecson commented 12 years ago

Hmm...Is there an error showing up, or just nothing happens?

WebberLai commented 12 years ago

there is a message "double free" .. I think it works fine now .

mutelove commented 12 years ago

Hi @LoveIphone can you send me your cod, I want page curl like iBooks, and I am working on Highlight my email address is: rashvand at hotmail.com

nikotung commented 11 years ago

Hi @WebberLai .I am starting create an epub reader .And I had read all the discussion above,it do help me a lot.Now I am facing a problem about "highlight".I can highlight the content user selected temporarily but I don't know how to save it for the next time. What I need to do is save the the highlighted content and highlight all the content user selected at the next time when user read in the book. I had tried to save the content of highlighted,and next time I search this content and make it highlight.But it will highlight all the same content,that is not what I expect. Have you done this highlight function. Any advice will help me? Thank you.

flyingsky commented 11 years ago

Hi,

You can change the html document and save it directly. Then you can see it next time you open it.

In another word you can do anything to the document you like, just save it.

发自我的 iPhone

在 2013-3-7,下午2:33,Ni notifications@github.com 写道:

Hi @WebberLai .I am starting create an epub reader .And I had read all the discussion above,it do help me a lot.Now I am facing a problem about "highlight".I can highlight the content user selected temporarily but I don't know how to save it for the next time. What I need to do is save the the highlighted content and highlight all the content user selected at the next time when user read in the book. I had tried to save the content of highlighted,and next time I search this content and make it highlight.But it will highlight all the same content,that is not what I expect. Have you done this highlight function. Any advice will help me? Thank you.

— Reply to this email directly or view it on GitHub.

nikotung commented 11 years ago

Hi @flyingsky My epub document is protected by DRM.So I don't think save the html will work. Thank you ,any way.

flyingsky commented 11 years ago

If so, I think you can do as you said before, saving the highlight in another file. But you can refer to the Range object in html. I think you can use it to define the highlighted content.

Thanks, Lianmeng(Ramon) Liu

On Mar 7, 2013, at 6:50 PM, Ni wrote:

Hi @flyingsky My epub document is protected by DRM.So I don't think save the html will work. Thank you ,any way.

— Reply to this email directly or view it on GitHub.

nikotung commented 11 years ago

@flyingsky I think it may work by saving the Range of the highlighted object and the current chapter index.But how can I get the Range of selected or highlighted contente,and transfer it to the objective-c range.I think it should use some javascript,but I know little about js.Can't you help !

flyingsky commented 11 years ago

Just learn js, which is easy :)

发自我的 iPhone

在 2013-3-8,上午9:22,Ni notifications@github.com 写道:

@flyingsky I think it may work by saving the Range of the highlighted object and the current chapter index.But how can I get the Range of selected or highlighted contente,and transfer it to the objective-c range.I think it should use some javascript,but I know little about js.Can't you help !

— Reply to this email directly or view it on GitHub.