Closed WebberLai closed 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.
@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
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.
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.
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 : )
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.
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 ;)
@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
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 ;)
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
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.
Happy Chinese new year to everyone ! I found an interesting kit , but not sure it is a reader or something ...
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.
@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 ??
@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
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
@Soniya-Iphonedev sorry for the delay. Here is the bookmark function in my project ,
/////////////////////////////////////////////////////////////////////////////
(IBAction) addToBookMarkClicked:(id)sender { NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
NSArray *bookmarks = [prefs objectForKey:[NSString stringWithFormat:@"bookmarks_%d",self.curBook.bookTag]];
NSMutableArray *marray = [NSMutableArray arrayWithArray:bookmarks];
NSString *loc = [NSString stringWithFormat:@"%d-%d-%d",currentSpineIndex,currentPageInSpineIndex,currentTextSize];
if (![marray containsObject:loc]) { [marray addObject:loc]; [self showTips:@"done."]; }else { [self showTips:@"bookmark exists."]; } bookmarks = [marray mutableCopy]; [prefs setObject:bookmarks forKey:[NSString stringWithFormat:@"bookmarks_%d",self.curBook.bookTag]]; [prefs synchronize]; [bookmarks release]; }
@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 ???
@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).
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
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 .......
@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.
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
@RenugaDevi Did you adjust the pic frame height ???
My code is adjust image width , set height auto size .
Hope this helps you .
@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
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 ???
@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..
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 .
@WebberLai : sendercustom@yahoo.com
your mail id is correct ah?
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
@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
No, please send me your sample project again with different name
@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
@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
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.
Thank you @WebberLai for this brilliant code work! I'm now trying your bookmark idea.
@jdpecson Wow ! please mail me if you finish this function : )
Hmm.... I thank you know what that mean ...
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
@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?
I don't know why my reader only works on simulator ...
Hmm...Is there an error showing up, or just nothing happens?
there is a message "double free" .. I think it works fine now .
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
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.
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.
Hi @flyingsky My epub document is protected by DRM.So I don't think save the html will work. Thank you ,any way.
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.
@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 !
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.
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
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 .
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
(void)viewWillAppear:(BOOL)animated : : UISwipeGestureRecognizer* rightSwipeRecognizer = [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(gotoNextPage)] autorelease]; [rightSwipeRecognizer setDirection:UISwipeGestureRecognizerDirectionLeft];
UISwipeGestureRecognizer* leftSwipeRecognizer = [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(gotoPrevPage)] autorelease]; [leftSwipeRecognizer setDirection:UISwipeGestureRecognizerDirectionRight]; //tap to show/hide tool bar
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)]; tapRecognizer.delegate = self; tapRecognizer.numberOfTapsRequired = 2; [webView addGestureRecognizer:tapRecognizer]; [webView addGestureRecognizer:rightSwipeRecognizer]; [webView addGestureRecognizer:leftSwipeRecognizer]; : : And change these method
Now it will have a page curl effect when you swipe your finger on screen.