Xamarin forms: Issue with epubreader NuGet Package - xamarin.forms

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.

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:
Open your Xamarin Project
Open References dialog, and then .Net Assembly tab.
Select ADBMobile.XamarinAndroidBinding.dll from the folder lib/Android.
Add your ADBMobileConfig.json file into the Assets folder of your project.
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:
Open your Xamarin Project.
Open References dialog, and then .Net Assembly tab.
Select ADBMobile.XamarinIOSBinding.dll from the folder lib/ios-unified.
Add your ADBMobileConfig.json file to the project.
You could check the docs for more details .

Related

Xamarin forms: Issue with epubreader.cross

I am using epubreader.cross 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);
For some .epb files I am getting below exceptions:
System.AggregateException: 'One or more errors occurred. (Incorrect EPUB navigation page target: normal is incorrect value for page target type.)'
System.AggregateException: 'One or more errors occurred. (Incorrect EPUB spine: TOC is missing)'
All my .epub files are able to view using Adobe Digital Editions 4.5.11. So what will be the reason behind this issue?
I have added a sample project here having .epub files for the reference.
That project seems to be deprecated. However , it looks like that the root repo is active though . You could check the github project site .
You need to download the dll file manually from this link , choose the for .NET Standard one . Then add the dll file into forms project , just right click Dependencies - Add project reference - Browse - Select the download file

Xamarin forms Multilingual not picking other language key

I am trying Xamarin forms a Multilanguage demo. In this, I tried both the options
1) plugin. Multilanguage package
2) static resource(without plugin).
I just downloaded the demo from the following site
1) https://github.com/CrossGeeks/MultilingualPlugin
2) https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/localization/text?pivots=windows
But both the demo not picking another language key. I appreciate your help.
This is an error after Visual Studio update (Version 8.6 (build 4520)). There is a workaround to use the Last stable version of Android SDK.
In Android.csproj, at the last line (inner the tag project) add the follow lines:
<Target Name="_ResolveSatellitePaths" DependsOnTargets="_ResolveAssemblies">
<ResolveAssemblyReference AllowedAssemblyExtensions="$(AllowedReferenceAssemblyFileExtensions)" AssemblyFiles="#(ResolvedUserAssemblies)" AutoUnify="$(AutoUnifyAssemblyReferences)" FindDependencies="True" FindRelatedFiles="False" FindSatellites="True" SearchPaths="$(AssemblySearchPaths)" TargetFrameworkMoniker="$(TargetFrameworkMoniker)" TargetFrameworkMonikerDisplayName="$(TargetFrameworkMonikerDisplayName)" TargetFrameworkDirectories="$(TargetFrameworkDirectory)">
<Output TaskParameter="SatelliteFiles" ItemName="_AndroidResolvedSatellitePaths" />
</ResolveAssemblyReference>
</Target>
EDIT:
there is already a VS update that solves this problem.

The target Flash Player version 11.1.0.0 specified should be equal or higher than the minimum version 23.0.0.0 required by Flex SDK

I am getting this error when trying to build an AdobeAir project.
I have an extension.xml file with this line:
<extension xmlns="http://ns.adobe.com/air/extension/4.0">
I tried to change it to 23.0 in the end, but it didn't help.
The error appeared after upgrading Air SDK from version 18 to 23.
The target Flash Player version 11.1.0.0 specified should be equal or
higher than the minimum version 23.0.0.0 required by Flex SDK
There is no place where 11.1.0.0 is mentioned
In your descriptor file (the one that ends in .xml), change the second line:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<application xmlns="http://ns.adobe.com/air/application/23.0">
It has to start with application, not with extension.
But, something is odd with the message, it indicates Flash Player instead of AIR.
You might want to change the compiler settings as well.
In Flash Builder, create or open a new project.
Open the project Properties panel (right-click and chose 'Properties').
Select Flex Compiler from the list on the left.
Add "-swf-version=34" to the 'Additional compiler arguments' field.
I have copied and adjusted the instructions from the Flash Player 23 Release Notes
There should be a descriptor file where you can define target-player version. I'm using IntelliJ as an IDE where it creates MyProjectName.iml and defines target-player version as below:
<configuration name="MyProjectName" target-platform="Desktop" main-class="Main" output-file="Main.swf" output-folder="$MODULE_DIR$/out/production/MyProjectName">
<dependencies target-player="23.0">
<sdk name="AIR SDK 23.0" />
</dependencies>
</configuration>

Downgrade FlashBuilder project

I have a Flash-Builder Flex project that was created (or upgraded) using FB 4.7.
I am using Flash-Builder 4, and the IDE doesn't recognize the project as a Flex project, so I can't import it into the IDE.
What are my options here? Is there a quick way of downgrading the project to a FB4 project?
1- SOLUTION 1 : verify your ".project" file: check if the project description is ok
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>MyProjectName</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.adobe.flexbuilder.project.flexbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.adobe.flexbuilder.project.flexnature</nature>
<nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
</natures>
</projectDescription>
2- SOLUTION 2 : put your project into your workspace and create a new project with the same name of your project folder name (for exp: if your project folder name "myproject" - create a new flex project with name "myproject"),
this will create a new flex project with your old source code.

Error when converting a site from Flex 3 to Flex 4

I'm moving a Flex 3 site to Flex 4, but when I run the application, it attempts to download a .swz file from Adobe, and gives the following error:
*** Security Sandbox Violation ***
Connection to http://fpdownload.adobe.com/pub/swz/tlf/1.1.0.604/textLayout_1.1.0.604.swz halted - not permitted from http://localhost/Fl/CityGIS/main.swf
Error #2048: Security sandbox violation: http://localhost/Fl/CityGIS/main.swf cannot load data from http://fpdownload.adobe.com/pub/swz/tlf/1.1.0.604/textLayout_1.1.0.604.swz.
Failed to load RSL http://fpdownload.adobe.com/pub/swz/tlf/1.1.0.604/textLayout_1.1.0.604.swz
Failing over to RSL textLayout_1.1.0.604.swz
Following this is an attempt to download the same file from localhost.
Is there a way to configure the SDK to get these files, or an issue with the configuration of my application?
I found I only had this problem when I using: -use-network=false, and I was attempting to run the html locally and the .swf was accessing locally files (outside the flex security free folders).
My workaround is to update sdks//frameworks/flex-config.xml (in the Flash Builder directory), and swap the order runtime shared paths: for example:
<runtime-shared-library-path>
<path-element>libs/textLayout.swc</path-element>
<rsl-url>http://fpdownload.adobe.com/pub/swz/tlf/1.1.0.604/textLayout_1.1.0.604.swz</rsl-url>
<policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
<rsl-url>textLayout_1.1.0.604.swz</rsl-url>
<policy-file-url></policy-file-url>
</runtime-shared-library-path>
TO:
<runtime-shared-library-path>
<path-element>libs/textLayout.swc</path-element>
<rsl-url>textLayout_1.1.0.604.swz</rsl-url>
<policy-file-url></policy-file-url>
<rsl-url>http://fpdownload.adobe.com/pub/swz/tlf/1.1.0.604/textLayout_1.1.0.604.swz</rsl-url>
<policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
</runtime-shared-library-path>
You'll have to do this for the other 5 or so entries.
Adobe should really look at this, and fix the problem.
Hope this helps.
Cheers
Parmy
I think the problem is that the location it is using for the textLayout swc
http://fpdownload.adobe.com/pub/swz/tlf/1.1.0.604/textLayout_1.1.0.604.swz
redirects to
/pub/swz/flex/4.1.0.15186/textLayout_1.1.0.601.swf
and the cross domains policy is not happy about that.
I think this points to an issue with the version of the sdk that you are using. You can go into sdks/<FRAMEWORK_VERSION>/frameworks/flex-config.xml (in the Flash Builder directory) and see exactly how the runtime shared library path is configured for textLayout.swc. This is what I have for flex_sdk_4.1.0.15186:
<!-- TextLayout SWC -->
<runtime-shared-library-path>
<path-element>libs/textLayout.swc</path-element>
<rsl-url>textLayout_1.1.0.601.swf</rsl-url>
<policy-file-url></policy-file-url>
<rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.1.0.15186/textLayout_1.1.0.601.swf</rsl-url>
<policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
</runtime-shared-library-path>
I suggest try switching to the latest 4.1 sdk and recompiling.
Hmmmm - generally this is because the site you are accessing does not contain a crossdomain.xml file. However I can download it from here.
Try adding this to your compiler options: -use-network=false
Then clean and force build your app.
If that doesn't work, and just grasping for straws, but have you tried to manually download it and place it in your project lib space?
Also, are you sure you are updated to Flex 4.1?
I just checked my local KB (evernote) and mentioned that FireFox sometimes has an issue with caching, and that restarting FF solved it once for me.

Resources