I need use Xamarin.GooglePlayServices.Maps in my Xamarin.Forms App. But I wrote all my pages in shared project (for example App) and I can instal Xamarin.GooglePlayServices.Maps only in android project (App.Android). Can I use this pakage (Xamarin.GooglePlayServices.Maps) in my shared project (App)?
Download "Xamarin.Forms.Maps" instead. It have Dependencies to "Xamarin.GooglePlayService.Maps" and more.
Like HeroesVII said, install the Xamarin.Forms.Maps for Xamarin.Forms. A code sample below for your reference.
The configuration process for displaying and interacting with a map on Android of Xamarin.Forms is:
Get a Google Maps API key and add it to the manifest.
Specify the Google Play services version number in the manifest.
Specify the requirement for Apache HTTP Legacy library in the manifest.
For mroe details of steps, you could check the MS docs.
You could download the source file from the link below.
https://learn.microsoft.com/en-us/samples/xamarin/xamarin-forms-samples/workingwithmaps/
I'd suggest you as #HeroesVII said you should try Xamarin.Forms.Maps, is more lightweight and simplistic. Either way if you want to stick to Xamarin.GooglePlayServices.Maps there shouldn't be any problem with it being in the standard project.
You can find and example here in this repo I created about two days ago.
There seem to be a good number of questions related to this, but I haven't found a solution to the problem yet. I apologize if the answer is here and I just haven't found it.
I'm trying to create a Web API project that gives me the middle layer between an HTML page for uploading a file and SQL database that stores the files. I know it's generally a bad approach to store files in the database, but I'm trying make a smaller test app that will help me diagnose a bigger problem in an existing database that I can't change.
I can set up a controller with a path like "api/docs/save" just fine, but saving the file in the database has become something of a nightmare. I can't seem to get a reference to "System.Data" or "System.Data.SqlClient" to work in the project. I've tried the NuGet packages with no luck. I even tried just making a class library using normal C# .NET, but adding a reference to that class library doesn't work either.
How do I set up a Web API project so I can use the data base access methods I'm used to?
As a side note: I don't have access to the existing front end code for the app, so I can't just add a test page there. I need to create something I can run locally through Visual Studio.
I can replicate your problem in VS 2017 using Core 1.1 and there does seem to be a problem.
After installing the NuGet package save and reload the project and it should be fine.
I'm using ImageResizing.Net within a class library as part of a back-end which requires bypassing Web.Config/App.Config by installing plugins in code like so:
ImageResizer.Configuration.Config.Current.Plugins.Install(new ImageResizer.Plugins.SimpleFilters.SimpleFilters());
ImageResizer.Configuration.Config.Current.Plugins.Install(new ImageResizer.Plugins.AdvancedFilters.AdvancedFilters());
I've verified that plugins are loaded within:
ImageResizer.Configuration.Config.Current.Plugins
I'm getting the following error when imageJob.Build(); is called:
Could not load file or assembly 'AForge.Imaging, Version=2.2.5.0, Culture=neutral, PublicKeyToken=ba8ddea9676ca48b' or one of its dependencies. The system cannot find the file specified.
Hoping this could be solved by referencing the libraries directly I've added the following using statements to the top of the class that uses ImageResizer:
using AForge;
using AForge.Imaging;
using AForge.Imaging.Filters;
using AForge.Imaging.ColorReduction;
using AForge.Imaging.ComplexFilters;
using AForge.Imaging.Textures;
Am still getting the same error. I've verified that the AForge references exist in my project, are the correct version and have "Copy Local" set to "True". These references were part of the dependencies that were automatically installed with the Nuget Packages for ImageResizing & the associated plugins.
UPDATE
I've decided to move the image processing over to a web api since the library was not designed for this scenario. This is called out by the author of the library in the comments of this S.O. question . I will mark this as the answer.
I've decided to move the image processing over to a web api since the library was not designed for this scenario. This is called out by the author of the library in the comments of this S.O. question
TL;DR:
Does anyone know of a way to reference Microsoft.Windows.Ocr (/ WindowsPreview.Media.Ocr.dll ) Assembly on a server-side ASP.Net Web application like MV4 Web API and make use of the OCR Functionality in that assembly to take a photo image as input and extract the text content out of it ? If yes, please provide detailed instructions in your answer.
Question Details (and what I have tried so far)
I am building a web application that takes an image uploaded to the Server (via a file upload UI screen) and then reads the text using OCR and displays the text on the next page, right next to the image that was uploaded.
Since most commercial OCR Libraries cost an arm and length (over $1,300 last time I checked) I thought I can try and use the Microsoft OCR Library Microsoft.Windows.Ocr that is FREE and seems to be very simple and straightforward to use.
So I tried to install the Microsoft.Windows.Ocr Nuget Package to my ASP.Net MVC4 Web API Project and that succeeded.
After that, I looked through my MVC4 Web API Project References, and to my surprise, did not find a reference to Microsoft.Windows.Ocr.dll Assembly.
So then I tried to add a reference to the x86 version of the Microsoft.Windows.Ocr.dll Assembly by browsing to that Assembly in the \packages folder, and selected the WindowsPreview.Media.Ocr.dll from \lib\win81\x86 folder
Note: The Assembly name is WindowsPreview.Media.Ocr.dll and not Microsoft.Windows.Ocr.dll , not sure why!
When I did that and clicked OK, I got the following Error Message.
---------------------------
Microsoft Visual Studio
---------------------------
A reference to
'D:\TestProjects\packages\Microsoft.Windows.Ocr.1.0.0\lib\win81\x86\
WindowsPreview.Media.Ocr.dll' could not be added. Please make sure
that the file is accessible, and that it is a valid assembly
or COM component.
---------------------------
OK
---------------------------
I then found out from the Nuget Page that the "Supported Platforms" are only Windows Phone 8, Windows Phone 8.1, Windows 8.1 (Windows Store apps only).
But surely, there must be a way to use this OCR dll on the Server-side in an ASP.Net Application?
Does anyone know of a way to reference Microsoft.Windows.Ocr (/ WindowsPreview.Media.Ocr.dll ) Assembly on a server-side ASP.Net Web application like MV4 Web API and make use of the OCR Functionality in that assembly to take a photo image as input and extract the text content out of it ?** If yes, please provide detailed instructions in your answer.
Any "hacks" and/or Sample code would be much appreciated!!
Thank you!!
If you are using Visual Studio 2015 and Windows 10, the
Microsoft.Windows.Ocr
has been moved to Universal Windows Platform. It is available as
Windows.Media.Ocr
So you need to upgrade your VS 2015 with tools for Windows 10 enabled.
I did the following and Windows.Media.Ocr got added as a reference in my Web API.
In your Web API project's references right click any of the references and click View in Object Browser. Your Object browser will look something like this
There is a '...' button right next to the "Browse: All components" Box. The tooltip reads "Edit Custom Component set".Click!
In the "Edit Custom Component Set" Box click the Browse Tab and Navigate to "C:/Program Files(x86)/Windows Kits/10/References/Windows.Foundation.UniversalApiContract/1.0.0.0"
and click the winmd file that results and click Add.
Hit Ok!
Now click icon that reads "Add to references in Selected Project in Solution Explorer"(It is the third button from the '...' button next to "Browse:"). You can see that Windows.Media.Ocr is available to use.
Note: The following works only with VS 2015 and windows 10. That too VS 2015 should be updated for Universal Windows Platform(UWP). Check this for a sample OCR.
Hope this helps.
Update
It got imported into my reference but is failing to load though. Hope it provides some start for people.
Thanks!.
You can Skip to Update 2 below for a working solution.
IT WILL THROW A TYPE LOAD EXCEPTION. That being said I am posting because I am trying to do the same thing but can't get the project to run. Here are some basic instructions on how to get the winrt api into your non windows app project.
http://weblogs.thinktecture.com/cnagel/2012/10/calling-winrt-from-windows-desktop-apps.html
Also don't try to reference the dll, reference instead the winmd file.
Here is a sample console app that references the ocr library but when you run the solution it throws the type load exception.(https://github.com/Xandroid4Net/MicrsoftOcrConsoleApp) It should be easily ported from a console app to and asp.net application. I don't know how to fix the type load exception maybe you can get farther than I can. Please post if you do find a solution.
UPDATE 1 (12/1/2014)
More digging revealed the following assembly binding error. Any idea how to set a package Id for a Process?
File: WindowsPreview.Media.Ocr!WindowsPreview.Media.Ocr.OcrEngine, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime.htm
File Contents:
* Assembly Binder Log Entry (12/1/2014 # 11:48:01 PM) *
The operation failed.
Bind result: hr = 0x80073d54. The process has no package identity.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable C:\Users\Wesley\Documents\Dev\ConsoleApplication2\Program.exe
--- A detailed error log follows.
BEGIN : Windows Runtime Type bind.
END : The process has no package identity. (Exception from HRESULT: 0x80073D54)
Update 2 (12/03/2014)
This is a nasty workaround but it worked on my Windows 8.1 Surface Pro 3 tablet. The WebOcr is a webforms but it can easily be refactored for MVC
1) Download https://github.com/Xandroid4Net/CommandLineOcr. This is the psuedo store app.
2) Build and run the app. It will appear to do nothing. That is okay, it will update the registry with a new key that we will need.
3) Download https://github.com/Xandroid4Net/WebOcr.
4) Find OcrCommandLineCaller.cs in the Webocr project.
5) Locate the registry key at HKEY_CURRENT_USER\Software\Classes\ActivatableClasses\Package\Some_Sort_Of_Guid_For_Your_APP\Server\App.App....\AppUserModelId
Refer to this SO question if you need more help finding the registry key. IApplicationActivationManager::ActivateApplication in C#?
6) Update the appActiveManager.ActivateApplication call in OcrCommandLineCaller.cs with the strange guid app identifier found in the registry key.
7) In default.aspx.cs replace the saveAsPath with the path on your machine. In the windows store app there is a static path represented by Windows.Storage.ApplicationData.Current.LocalFolder. This is the path where I saved my images for simplicity.
8) Modify any of the code to your heart's content and let me know if you have any questions.
This is a very rough and nasty solution, but it does work.
I have been using the MODI solution packaged with MS Office for a few years, and was pretty happy with it (it was free if you bought Office). I was rather disappointed when it was discontinued.
I've tried Tesseract... I really wanted to like it, but found it slow and inaccurate for Dutch machine type of good quality... and like you, I could not justify spending anything north $200 for what was essentially a hobby project.
After a desperate search, someone on here pointed me at TOCR (a Transym product). An epiphany followed soon after. ;-)
I think I need to say at this point that I am not affiliated with Transym in any way, and yes, I paid the full price... of 60 pounds! (no typo... sixty quid), which, including VAT, worked out to 113 euros.
It is essentially meant for integrators (it includes a scan/viewer/OCR app, but that is merely meant as a demo - if you buy the license, you get its source code). The API is outdated (it is, as OCR engines go, quite a mature code base), but it is fast, stable, and unexpectedly accurate. Not as accurate as the DokuStar engine or other esoteric engines, but for my application (Dutch and ENglish machine type) it holds its own against various engines that are well north of $1000. Recognition accuracy on Dutch machine type is excellent (it doesn't do handwriting).
In my opinion, in terms of value for money, it is simply ridiculously good.
As to the API: I wrote a rudimentary .NET wrapper around it to suit my needs - this was done in a few evenings.
There is an eval version available on their web site (http://www.transym.com/index.htm). And no, I don't get any money if you do ;-)
I managed to invoke the OCR from Web API by invoking the DLL from powershell. I found also that you cannot invoke this DLL in parallel.
It took me a few days, but here is the repo. Available both as nuget and web API with Windows docker https://github.com/MihaiTheCoder/ocr-all-in-one
I developed Web API project mostly for this question, so hopefully somebody will find it useful.
The powershell that is invoking Windows OCR is here: https://github.com/MihaiTheCoder/ocr-all-in-one/blob/master/Ocr.Wrapper/Resources/Get-Text-Win-OCR.ps1
It is a 2 stage process because the initialization of the OCR engine takes more time, and it is better to have it cached.
IMHO, probably not worth your effort to try to use a library that is not supported on the platform you are targeting.
You could check this answer for some free alternatives.
I managed to get the UWP OCR API working on desktop app using uwpdesktop NuGet.
Install-Package uwpdesktop
You can then make calls to UWP APIs.
I am not a lawyer, but my understanding is the the Microsoft end user license agreement for that library does not allow to use the Microsoft OCR Library for Windows Runtime in your scenario.
Specifically, read the second paragraph, where it forbids to use the software on a server in a production environment:
"2. INSTALLATION AND USE RIGHTS.
a. General. One user may install and use copies of the software to
design, develop, test and demonstrate your programs. You may not use
the software on a server in a production environment."
At the same time, they also restrict the run of the distributable code exclusively to Windows Store or Windows Phone:
"3. ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.
a. Distributable Code. The software contains code that you are
permitted to distribute in programs you develop if you comply with the
terms below.
i. ..
ii. ..
iii. Distribution Restrictions. You may not
..
ยท distribute Distributable Code to run on a platform other
than the Windows Store or Windows Phone;"
The full EULA can be read at: https://www.microsoft.com/web/webpi/eula/windows_runtime_ocr_library_terms_of_use.htm
I'm trying to connect to Google Drive with its API. Google states that it provides the necessary DLLs and references at this link here ("Download the latest version of the library"). However, when I try to add the necessary reference(s), C# is unable to find any DLLs and a manual search for them yields 0 results. From the referenced link:
The ZIP file contains the core library and Drive-specific DLLs.
Referencing these DLLs in your solution is discussed in the next
section.
The following namespaces need references:
using DotNetOpenAuth.OAuth2;
using Google.Apis.Authentication.OAuth2;
using Google.Apis.Authentication.OAuth2.DotNetOpenAuth;
using Google.Apis.Drive.v2;
using Google.Apis.Drive.v2.Data;
using Google.Apis.Util;
using Google.Apis.Services;
In looking around on the Google link, I don't find anything with the necessary DLLs that are referenced in the above.
Note: this is a test desktop console app, not a web application.
Edit: I should add, if I add the below files as Existing Items, it still is unable to find most of the assemblies:
Google.Apis.Drive.v2.1.5.0.95-beta.nuspec
Google.Apis.Drive.v2.cs
Google.Apis.Drive.v2.csproj
packages.config
using DotNetOpenAuth.OAuth2;
using Google.Apis.Authentication.OAuth2;
using Google.Apis.Authentication.OAuth2.DotNetOpenAuth;
using Google.Apis.Util;
using Google.Apis.Services;
You can download the API and it's dependencies via Nuget.org if you want them precompiled. The Nuget version is only slightly out-of-date however, if you want the newest version you will have to download the source and build it.
I'd say go with the Nuget version for simplicity.
Google Drive API on Nuget.org