System.Drawing and gdiplus.dll on Android

Hi ! I need to use the convertion of .doc or docx to pdf format on an Android device (galaxy tab).
I get this error :

DllNotFoundException: gdiplus.dll
09-28 14:10:39.338 16346 16364 I Unity   :   at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup (ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
09-28 14:10:39.338 16346 16364 I Unity   :   at System.Drawing.GDIPlus..cctor () [0x00000] in <filename unknown>:0
09-28 14:10:39.338 16346 16364 I Unity   : Rethrow as TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.GDIPlus
09-28 14:10:39.338 16346 16364 I Unity   :   at System.Drawing.Image.InitFromStream (System.IO.Stream stream) [0x00000] in <filename unknown>:0
09-28 14:10:39.338 16346 16364 I Unity   :   at System.Drawing.Bitmap..ctor (System.IO.Stream stream, Boolean useIcm) [0x00000] in <filename unknown>:0
09-28 14:10:39.338 16346 16364 I Unity   :   at System.Drawing.Bitmap..ctor (System.IO.Stream stream) [0x00000] in <filename unknown>:0
09-28 14:10:39.338 16346 16364 I Unity   :   at (wrapper remoting-invoke-with-check) System.Drawing.Bitmap:.ctor (System.IO.Stream)
09-28 14:10:39.338 16346 16364 I Unity: at..ctor(System.Byte[])[0x00000] in <filename unknown>: 0
09-28 14:10:39.338 16346 16364 I Unity: at.()[0x00000] in <filename unknown>: 0
09-28 14:10:39.338 16346 16364 I Unity: at.(System.IO.Stream)[0x00000] in <filename unknown>: 0
09-28 14:10:39.338 16346 16364 I Unity: at.(.)[0x00000] in <filename unknow

I tried to insert both dll files in StreamingAssets and/or in Assets/Plugins and same issue. I also tried to build the apk from windows 10 and macOS and same issue. The app is developed with Unity.
Good news the pdf convertion works very well using the simulator of unity on Windows/macOS but I don’t care I need to convert the file on the android device…
Please help!
Thanks!

@Silvering,

Are you getting this problem with the latest version of Aspose.Words for Android via Xamarin i.e. 17.9?

Do you see this problem with one particular document or every Word document you try to convert to PDF cause the same exception?

Also, please try the Aspose.Words.Examples.XamarinAndroid.sln (XamarinAndroid) example on your end.

In case the problem still remains, please ZIP and attach your input Word document and Simple Android project here for testing. We will investigate the issue on our end and provide you more information.

@awais.hafeez
Thanks for your reply. I will test the latest version of Aspose Words for android via Xamarin today. I was using the .NET version because of Unity. However my app runs on Android device so I think your solution will be the good one. I downloaded the latest version so, but just to be sure I need to copy the Aspose.Words.Android.Xamarin.dll and Aspose.Words.Android.Xamarin.xml files next to the Aspose.Words.lic, right ? When I call the licence using the code below it will automatically load the right .dll ? All these files are currently in my Assets/Plugins folder.

Aspose.Words.License license = new Aspose.Words.License ();

	// This line attempts to set a license from several locations relative to the executable and Aspose.Words.dll.
	// You can also use the additional overload to load a license from a stream, this is useful for instance when the 
	// license is stored as an embedded resource
	try {
		license.SetLicense (AppVariables.ressource_path + "Plugins/Aspose.Words.lic");
		Debug.Log ("License set successfully.");
	} catch {
		// We do not ship any license with this example, visit the Aspose site to obtain either a temporary or permanent license. 
		Debug.Log ("There was an error setting the license: ");
	}

Thanks for your support.

Are you sure that I can use the .dll for android xamarin in my Unity project ??

@Silvering,

You need to have ‘Aspose.Words.Android.Xamarin.lic’ license file to be able to use ‘Aspose.Words for Android via Xamarin’ API in your native Xamarin.Android application. However, you cannot use it with ‘Aspose.Words for .NET’ license. Please refer to the following article:
How to Apply License?

It seems that you can use Aspose.Words for .NET in your Unity project. The problem occurs because these libraries are not present on your device. However, you might get help from the following thread as to why System.Drawing.dll and gdiplus.dll do not work when you deploy Unity project on your Android device.
How do you load System.Drawing.dll and gdiplus.dll on Unity Mac?

As per the following thread, you cannot use Aspose.Words for Android via Xamarin with Unity:
Can Xamarin and Unity be used together?