Error when converting pptx to pdf by android using slides cloud


#1

String password = “b1234567”;
String format = “pdf”;
String outPath = “/storage/emulated/0/Download/pptx.pdf”;
String fontsLocation=“fonts”;
File f = new File("/storage/emulated/0/Download/pptx.pptx");

        // Invoke Aspose.Slides Cloud SDK API to convert document to other format using storage
        ResponseMessage apiResponse = slidesApi.PutSlidesConvert(password, format, outPath, f);
        if (apiResponse != null)
        {
            System.out.println("Convert PowerPoint Documents to other File Formats without Using Storage, Done!");
        }

I use the code above to convert pptx to pdf, but the error shows:
07-25 15:40:44.863 25737-25737/com.nwstor.condor E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.nwstor.condor, PID: 25737
java.lang.ExceptionInInitializerError
at com.b.b.f.e.(FormDataMultiPart.java:93)
at com.aspose.slides.api.SlidesApi.PutSlidesConvert(SlidesApi.java:555)

And it is located at ResponseMessage apiResponse = slidesApi.PutSlidesConvert(password, format, outPath, f);


#2

@beneven

Thank you for contacting Aspose Support. Our existing Aspose.Slides Android SDK is a deprecated SDK and we are not maintaining it anymore. We are working to release completely revamp Aspose.Slides Android SDK here.

Meanwhile, we would request you to call our Aspose.Slides REST APIs directly in your Android app. We have written following cURL example to help you better understand the PUT /slides/convert API:

// First get Access Token
// Get App Key and App SID from https://dashboard.aspose.cloud/
curl -v "https://api.aspose.cloud/oauth2/token" \
-X POST \
-d 'grant_type=client_credentials&client_id=0B17F60A-6D69-426B-9ABD-79F35A6E9F7B&client_secret=53b8b19adffa41a3e87dbbd8858977ae' \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

// cURL example to convert PPTX file to PDF
curl -v "https://api.aspose.cloud/v1.1/slides/convert?format=pdf" \
-X PUT \
-T demo.pptx \
-H "Content-Type: multipart/form-data" \
-H "Accept: multipart/form-data" \
-H "Authorization: Bearer OzyILamfBYRMQei8rwFaCLs0X1cAOSFq292v4JqNNtGih7SzTkk55iCumhe0jpTgQIv8WhAaTLFsKclrMw2X6UeWUiUbqfl5S_iy-FDBn0OQGOU-5ROmA2YBw35AU9Uqyjx0vQKEPlQpg-wLTGPmfp_hXgC54n5embIp-XBfOy6Jb4gQHWzTzzsB6uns3TXFHEQodWo77rxJP5LeHbMerrs4ECOjwMQumY85h2ZFz8Q2cVz8cLguXySlxBY9eJAksc4e3M0oLcjsehHfHtnxkn8eFUtSpcE7TRKkrXX04Qd6CvdmgGW0UXu4U1PlmE3GTc3JXwgvG0OtNyfLTTu6pDg5YzlEOhLOFYICbuf9aw6TUS_jkre3g4h9NNoBgMFbThgjzQZD-roJNRyYEbf6Gim09sHKyX0WK9SJQrPHxs1ec99w7GLO3shUJS1IYQTvjXr8kYQjlQ8wcwEOOUqwD1KC-Dk" \
-o demo.pdf

Hope this helps!