Sreejith Sree
Sreejith Sree

Reputation: 3681

Xamarin forms: Issue with epubreader NuGet Package

I am using epubreader (vers-one) NuGet package for parsing .epub files.

My Code:

string fileName = "SampleEPUB.epub";
var assembly = typeof(MainPage).GetTypeInfo().Assembly;
Stream stream = assembly.GetManifestResourceStream($"{assembly.GetName().Name}.{fileName}");
EpubBook epubBook = EpubReader.ReadBook(stream);
foreach (EpubNavigationItem chapter in epubBook.Navigation)
{
    chapterDetails.Add(new ChapterDetails() { title = chapter.Title, htmlData = chapter.HtmlContentFile?.Content, subChapters = chapter.NestedItems });
}

1 When parsing the epub file like above, I am getting only one chapter(chapter name is content). If I click that chapter there is no data.

2 When we open that epub files using Adobe Digital Editions 4.5.11, there are a lot of chapters and contents. I need to parse all the chapters and TOC in the epub file. Please help me to find the issue behind this.

3 Also tried epubreader.cross NuGet package, but that project is deprecated. Are there any other NuGet packages for parsing epub files?

4 Currently, I have added sample epub files to the project and implemented parsing for it. Instead of that if the epub file is a link how I can manage it?

I have added a sample project here having .epub files for the reference. I have already posted a question related to this, but it not solved my problem completely.

Upvotes: 1

Views: 154

Answers (1)

Lucas Zhang
Lucas Zhang

Reputation: 18861

Since it works in Adobe Digital Editions 4.x.x , we could install the plugin to our application .

Adobe Mobile SDK is no longer available in the Xamarin Components Store or in the NuGet Gallery. To download the Xamarin components, we need to go to GitHub download it directly.

Android

Import the ADBMobile Component to your Xamarin.Android Project:

  1. Open your Xamarin Project
  2. Open References dialog, and then .Net Assembly tab.
  3. Select ADBMobile.XamarinAndroidBinding.dll from the folder lib/Android.
  4. Add your ADBMobileConfig.json file into the Assets folder of your project.
  5. Add permissions for:

• INTERNET • ACCESS_NETWORK_STATE

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Add the following activity and receiver if you are using In-app messaging:

<activity
android:name="com.adobe.mobile.MessageFullScreenActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<receiver android:name="com.adobe.mobile.MessageNotificationHandler" />

Add the following receiver if you are using acquisition:

<receiver android:name="com.your.package.name.GPBroadcastReceiver" android:exported="true">
 <intent-filter>
 <action android:name="com.android.vending.INSTALL_REFERRER" />
 </intent-filter>
</receiver>

iOS

Import the ADBMobile Component to your Xamarin.iOS Project:

  1. Open your Xamarin Project.
  2. Open References dialog, and then .Net Assembly tab.
  3. Select ADBMobile.XamarinIOSBinding.dll from the folder lib/ios-unified.
  4. Add your ADBMobileConfig.json file to the project.

You could check the docs for more details .

Upvotes: 1

Related Questions