Jakub Florczyk - Blog o programowaniu .NET

Programista praktyczny

Epub Reader dla Windows Phone

Od dłuższego czasu pracuję nad czytnikiem książek w formacie EPub dla Windows Phone. Niestety .NET to nie Java i ilość dostępnych komponentów nie jest taka duża jak u starszego brata.

Ponieważ nie znalazłem żadnego projektu open source czytnika postanowiłem sam go napisać co wynikało z zamówienia klienta. A sam open source ma pomóc w testowaniu komponentu i developerce.

Komponent dostępny jest na stronie projektu epubreaderwp.codeplex.com.

Cechy:

  • ustawienia: FontSize, FontFamily, LineHeight, Brightness
  • tryb nocny i dzienny
  • stan normalny (odczyt), widok spisu treści oraz okładki
  • dostęp do metadanych książki

Zrzuty ekranu:

20 ResponsesLeave one →

  1. hamza

     /  2013-03-19

    can you detail more how i can implement your Library to display my epubbook from the isolated storage

  2. admin

     /  2013-03-19

    hamza: can you detail more how i can implement your Library to display my epubbook from the isolated storage

    Read stream from IsolatedStorageFile:

    IsolatedStorageFileStream isfs;
    using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
    {
    try
    {
    isfs = isf.OpenFile([Path to file], FileMode.Open);
    }
    catch
    {
    return;
    }
    }

    EPubViewer.Source = isfs;

  3. hamza

     /  2013-03-28

    hi another question please i try to read an epub book with your Library if it’is from Gutenberg which is a site of free ebooks it crashed and if it is from another site i can display it although there are build with same epub 2.0 it is illogical?

  4. Flaw

     /  2013-04-21

    Hej używam twojego czytnika od niedawna i odwaliłeś kawał porządnej roboty :) ale jest jeden problem, jeśli wchodzę w zrobione przeze mnie opcje lub w jakś inną stronę i cofnę się to wszystko jest renderowane zupełnie inaczej niektóre elementy strony, tekst są ucinane :/, coś musi być nie tak z metodą Render, używam sourca z codplexa. Może znalazłeś już jakiś sposób żeby temu przeciwdziałać, byłbym wdzięczny za pomoc :)

  5. admin

     /  2013-04-21

    hamza: hi anotherquestion please i try to read an epub book with your Library if it?is from Gutenbergwhich is a site of free ebooks it crashed and if it is from another site i can display it although there are build withsame epub 2.0 it is illogical?

    Send me sample book to jakub.florczyk (at) gmail.com on which error occurs.

  6. Shehzad

     /  2013-05-09

    I don’t think this application supports Windows Phone 8 at the moment.
    How can we get to support this for Windows Phone 8?
    Or it already does support Windows Phone 8?

  7. admin

     /  2013-06-15

    Shehzad: I don?t think this application supports Windows Phone 8 at the moment.
    How can we get to support this for Windows Phone 8?
    Or it already does support Windows Phone 8?

    It should work on WP8, but I dont have phone and proper computer with vitrual machine to test it :(

  8. Kau Buon Vi Ai

     /  2013-07-04

    Hi all,
    Please help me to import library to my project ????
    i import EpubReader.dll –> program did not work
    What can i do ? Import all dll of library to my project ?

  9. Kau Buon Vi Ai

     /  2013-07-04

    Kau Buon Vi Ai: Hi admin,
    in example of admin, i did not find two properties CurrentPageNumber and PagesCount of epub reader. The beta version of epub on codeplex is latest version ???
    Please help to check this problem.

  10. admin

     /  2013-07-04

    Kau Buon Vi Ai: Hi all,
    Please help me to import library to my project ????
    i import EpubReader.dll ?> program did not work
    What can i do ? Import all dll of library to my project ?

    Add reference to EpubReader.dll; reset of required dll’s should add automaticly. On page in definitions add:
    xmlns:epubreader=”clr-namespace:EPubReader;assembly=EPubReader”
    and add control
    <epubreader:EPubViewer x:Name=”ePubViewer”/>
    from code add loading book
    ePubViewer.Source = [some code to load book from resource or stroage]

  11. admin

     /  2013-07-04

    Kau Buon Vi Ai: CurrentPageNumber

    Source on CodePlex is the latest. In last version CurrentPage and PagesCount is replaced by: CurrentLocation and FurthestLocation. Anyway control navigates by themself.

  12. Kau Buon Vi Ai

     /  2013-07-04

    Hi admin,
    I can add your library to my project. Thanks so much.
    But in example of u, i did not find two properties CurrentPageNumber and PagesCount of epub reader. The beta version of epub on codeplex is latest version ???
    i found example as below :
    // Simple navigation
    private void EPubViewer_Tap(object sender, GestureEventArgs e)
    {
    if (EPubViewer.State != EPubReader.State.Normal)
    return;

    if (e.GetPosition(EPubViewer).X 1)
    EPubViewer.CurrentPageNumber–;
    else if (e.GetPosition(EPubViewer).X >= 320 && EPubViewer.CurrentPageNumber < EPubViewer.PagesCount – 1)
    EPubViewer.CurrentPageNumber++;
    }

  13. Kau Buon Vi Ai

     /  2013-07-04

    Hi admin,
    Thanks so much, i found CurrentLocation and FurthestLocation.

  14. Kau Buon Vi Ai

     /  2013-07-04

    Hi admin,
    I can use CurrentLocation and FurthestLocation to navigate page on book.
    But i recognize that the problem : the speed of loading page follow table of content or tab to navigate page is too slow.
    I use LUMIA 520 (dual core 1ghz, ram 512) and build project on WP8.
    I use this code of u to navigate page.
    So what can i do to improve this speed ?

  15. Kau Buon Vi Ai

     /  2013-07-04

    I recognize more problem : the speed of loading page on my phone is slower than virtual machine :) !

  16. Kau Buon Vi Ai

     /  2013-07-05

    admin:
    Source on CodePlex is the latest. In last version CurrentPage and PagesCount is replaced by: CurrentLocation and FurthestLocation. Anyway control navigates by themself.

    I want to navigate by myself, what can i do?
    And help me to explain problem when load page ?
    Thanks.

  17. xiaofan

     /  2013-08-26

    Hi,I saw your artical on codeplex and I have loaded your dll.
    But a exception occured .That is there is some chapter can’t show when go to that page, the perogram shut down.I don’t know why,can you give me some suggestion??Thank you so much.

  18. xiaofan

     /  2013-08-26

    It is on WP8 platform

  19. GDEVENDRAK

     /  2014-01-28

    Hello everyone,

    I integrated this reader to my project. It is working fine. & I want to load the file from SDCard instead of Isolated storage of device

    To open file from Isolated storage we have “`IsolatedStorageFileStream“`

    Right know I tried like this

    “`
    ExternalStorageDevice sdCard = (await ExternalStorage.GetExternalStorageDevicesAsync()).FirstOrDefault();

    // If the SD card is present, get the route from the SD card.
    if (sdCard != null)
    {
    ExternalStorageFile file = await sdCard.GetFileAsync(_sdFilePath);
    // _sdFilePath is string that having file path of file in SDCard

    // Create a stream for the route.
    Stream file = await file.OpenForReadAsync();

    // Read the route data.
    ePubView.Source = file;
    }
    “`

    Please give a suggestion regarding this..
    Thanks

Leave a Reply