An Error Occurs while Converting PPT to PDF in Java on Android

Android java ppt CONVERT pdf error! →

at com.aspose.slides.Collections.Generic.Dictionary.pp(Unknown Source:5)
at com.aspose.slides.Collections.Generic.Dictionary.c4(Unknown Source:13)
at com.aspose.slides.Collections.Generic.Dictionary.set_Item(Unknown Source:78)
at com.aspose.slides.internal.mv.n2.ui(Unknown Source:10)
at com.aspose.slides.internal.z2.pp.ui(Unknown Source:86)
at com.aspose.slides.internal.mv.pp.ui(Unknown Source:6)
at com.aspose.slides.internal.mv.o1.pl(Unknown Source:692)
at com.aspose.slides.internal.mv.o1.ui(Unknown Source:31)
at com.aspose.slides.internal.mv.o1.ui(Unknown Source:4)
at com.aspose.slides.internal.an.sj.ui(Unknown Source:33)
at com.aspose.slides.internal.an.j1.ui(Unknown Source:28)
at com.aspose.slides.internal.an.j1.ui(Unknown Source:0)
at com.aspose.slides.internal.an.c4.sk(Unknown Source:12)
at com.aspose.slides.internal.an.c4.lu(Unknown Source:0)
at com.aspose.slides.internal.zp.r0.pl(Unknown Source:4)
at com.aspose.slides.internal.zp.r0.pp(Unknown Source:0)
at com.aspose.slides.cql.ui(Unknown Source:37)
at com.aspose.slides.cql.ui(Unknown Source:509)
at com.aspose.slides.cql.ui(Unknown Source:179)
at com.aspose.slides.cx9.ui(Unknown Source:1674)
at com.aspose.slides.ijx.ui(Unknown Source:73)
at com.aspose.slides.ijx.(Unknown Source:266)
at com.aspose.slides.nhm.ui(Unknown Source:86)
at com.aspose.slides.jl0.ui(Unknown Source:40)
at com.aspose.slides.jl0.ui(Unknown Source:309)
at com.aspose.slides.jl0.ui(Unknown Source:18)
at com.aspose.slides.qh.ui(Unknown Source:314)
at com.aspose.slides.x6g.ui(Unknown Source:27)
at com.aspose.slides.d8.c4(Unknown Source:156)
at com.aspose.slides.d8.ui(Unknown Source:3)
at com.aspose.slides.j1l.c4(Unknown Source:10)
at com.aspose.slides.j1l.ui(Unknown Source:255)
at com.aspose.slides.j1l.ui(Unknown Source:9)
at com.aspose.slides.j1l.ui(Unknown Source:14)
at com.aspose.slides.Slide.ui(Unknown Source:85)
at com.aspose.slides.mpo.ui(Unknown Source:382)
at com.aspose.slides.mpo.ui(Unknown Source:19)
at com.aspose.slides.Presentation.ui(Unknown Source:583)
at com.aspose.slides.Presentation.save(Unknown Source:12)
at com.example.wordpdf2.ConvertUtils.ppt2PDF(ConvertUtils.java:48)
at com.example.wordpdf2.MainActivity.onCreate(MainActivity.java:56)
at android.app.Activity.performCreate(Activity.java:8595)
at android.app.Activity.performCreate(Activity.java:8573)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1456)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3764)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3922)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

@wangyiqun,
感谢您联系支持部门。

为了调查此问题并帮助您,我们需要更多的详细信息。请提供以下文件和信息:

  • 示例 PowerPoint 演示文稿文件
  • 用于重现错误的代码示例
  • 运行代码的操作系统版本
  • 您应用程序中的 JDK 目标版本
  • 您使用的 Aspose.Slides 版本

Thank you for your reply.

There are two zip packages attached to my email, which are word2pdf.zip for my project files and test.zip for excel, ppt and word files to be converted. My project is to convert ms file to pdf file. However, when converting 1.xls 1.xlsx, the generated pdf cannot be opened.Also, I can’t convert a ppt file with more elements like “大杂烩.ppt.”

My project is an android project, and the configuration of the project is in the app directory bulid.gradle.Help me figure out what the problem is. In addition, whether to support the conversion of ppt excel containing Chinese.

Thanks again
test.zip (490.3 KB)

wordpdf2.zip (632.7 KB)

@wangyiqun,
Thank you for the details.

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): SLIDESANDROID-506

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.

Yes, Aspose products support Chinese language.

As for the Word and Excel documents, my colleagues from Aspose.Words and Aspose.Cells teams will answer you shortly.
@alexey.noskov, @amjad.sahi FYI

@wangyiqun,

For Aspose.Cells for Android via Java issue(s), we evaluated and here are our findings.
1). We checked your sample code segments and found the corrupted PDF is due to the fact that you have not used SaveFormat from Aspose.Cells for Android via Java API. Please use fully qualified naming when defining or using objects of different APIs. For example, you may change to com.aspose.cells.SaveFormat in excel2PDF(String inpath) method.

public static void excel2PDF(String inpath){
        // 创建一个Workbook对象并加载XLS文件
        InputStream inputStream  = null;
        try {
            inputStream = new FileInputStream(new File(inpath));
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }
        Workbook doc = null;
        try {
            doc = new Workbook(inpath);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        try {
            doc.save(inpath+".pdf",com.aspose.cells.SaveFormat.PDF);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

2). Regarding fonts rendering problems for Aspose.Cells, you copy required fonts files into a folder (make sure that the app has the rights to get the font files in the folder). Then set the folder to Aspose.Cells at the start of your application.
e.g.,

com.aspsoe.cells.FontConfigs.setFontFolder(fontFolder1, true);

3). For missing contents (e.g., first two columns) in the output PDF, it seems some printable area is set for PageSetup for the worksheet for the file, so you may check and remove that area in PageSetup dialog box in MS Excel. Please note, if you have set some printable area for the sheet, only printable area would be rendered to PDF, this behavior is same with MS Excel. In any case, please share us the (new) source Excel file and the generated PDF file by Aspose.Cells for Android via Java. We will check your issue soon.

Also, you may follow up your dedicated thread for your further reference and updates.

@wangyiqun,
As for Aspose.Slides, the problem happened due to lack of memory. To fix the problem, you should add two parameters to AndroidManifest.xml:

<application
    android:supportsRtl="true"
    android:largeHeap="true"
    ....>
    <activity
        .....
    </activity>
</application>

You should also load the fonts used in the presentation using the FontsLoader class (for example SimSun, Segoe UI Emoji, Calibri, Arial, etc):

FontsLoader.loadExternalFonts(new String[]{"path_to_fonts"});

Custom PowerPoint Font in Java|Aspose.Slides Documentation

We also found and registered some issues with emojis and text. Our developers will do their best to resolve the issues as soon as possible.

Thank you, and thank you so much to your developers

@wangyiqun,
Thank you for using Aspose products.