PPT to PDF Conversion: Aspose + Unity + Android + Java

Hi,

I am trying to use Aspose.Slides for converting PPT to PDF. I have downloaded Aspose.Slides DLL and kept it inside the Plugin folder in unity. It is perfectly working fine in the editor. However when I take a build for android I get following errors.

PlatformNotSupportedException: Operation is not supported on this platform.
07-03 21:00:56.949 11207 11234 E Unity : at Aspose.Slides.:spades: …cctor () [0x00000] in <05009956c08e468c73baf6a503d097b5>:0

Since I couldnt file any dll for android in unity, I was using the jar file provided by aspose for android in java.

Note: Placed the jar file in Plugins folder in unity

And I have changed my C# script like this to utilize the jar file library.

AndroidJavaClass asposeSlidesClass = new AndroidJavaClass("com.aspose.slides.Presentation");
AndroidJavaObject presentation = asposeSlidesClass.CallStatic<AndroidJavaObject>("newInstance", pptFilePath);
presentation.Call("save", outputPath, 1); // 1 represents the SaveFormat.Pdf enumeration value
presentation.Dispose();

But i was getting following errors

AndroidJavaException: java.lang.NoSuchMethodError: no static method with name=‘newInstance’ signature=’(Ljava/lang/String;)Ljava/lang/Object;’ in class Ljava.lang.Object;
07-04 07:53:51.396 5816 5842 E Unity : java.lang.NoSuchMethodError: no static method with name=‘newInstance’ signature=’(Ljava/lang/String;)Ljava/lang/Object;’ in class Ljava.lang.Object;

Meaning: the method name “newInstance” and its signature provided may not be correct for the Aspose library I am using.

Queries:

1.) How to integrate Aspose.slides in unity to work in Android?
2.) Can you tell me how to call the presentation method in java?
3.) Can you provide the correct method and its signature for creating an instance of the Presentation class in Java?

@evcarsolutions,
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESJAVA-39238

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Please also share the following additional information if it is possible:

  • OS version on which the errors occurred
  • Aspose.Slides version you used

I would have requested for a paid service , but i am still not sure whether this asset works in unity android.

OS Version: Windows 10
Aspose.Slides Version: 23.6

@evcarsolutions,
Thank you for the additional information. I forwarded it to our developers.

@evcarsolutions,
Our developers have investigated the case.

The AndroidJavaObject constructor allows passing parameters that will be in turn passed along to the Java constructor. To initialize a Presentation object, pass an argument to AndroidJavaObject:

AndroidJavaClass asposeSlidesClass = 
    new AndroidJavaClass("com.aspose.slides.Presentation", pptFilePath);

We have a dll with the Xamarin-Android version. Please, check Downloads ---New Releases-aspose.slides-for-.net-22.10(dlls-only). We hope this version will suit your requirements more than using the AndroidJavaClass and working with JNI.

Thanks for the response. Will try it and let you know.

@evcarsolutions,
We will be waiting for your feedback.

@andrey.potapov

No it didnt work. I am getting following errors. when I loaded the xamarian dll

Error: Could not load signature of : due to: Could not resolve type with token 01000076 (from typeref, class/assembly System.Collections.Generic.Queue1, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) assembly:mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e type:System.Collections.Generic.Queue1 member:(null) signature:

Unloading broken assembly Assets/Plugins/Aspose.Slides.Droid.dll, this assembly can cause crashes in the runtime

@evcarsolutions,
Thank you for the information. I forwarded it to our developers. We will continue investigating the issue.

@evcarsolutions,
Could you please share a sample project that shows the errors you described?