We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

KeyNotFoundException thrown when converting PPT to PPTX

hi,
something wrong happens when I convert the following ppt to pptx.ws.zip (408.7 KB)

It works well in most environment, but not mime. I run it in my docker container. The Dockerfile is

FROM arm64v8/centos:8
RUN yum install -y epel-release && yum update -y && yum install -y java-1.8.0-openjdk ImageMagick

class com.aspose.slides.exceptions.KeyNotFoundException: The given key was not present in the dictionary.
com.aspose.slides.Collections.Generic.Dictionary.get_Item(Unknown Source)
com.aspose.slides.oz.do(Unknown Source)
com.aspose.slides.oz.do(Unknown Source)
com.aspose.slides.apb.do(Unknown Source)
com.aspose.slides.apb.do(Unknown Source)
com.aspose.slides.apb.do(Unknown Source)
com.aspose.slides.apb.(Unknown Source)
com.aspose.slides.TextFrame.do(Unknown Source)
com.aspose.slides.TextFrame.do(Unknown Source)
com.aspose.slides.TextFrame.void(Unknown Source)
com.aspose.slides.r.do(Unknown Source)
com.aspose.slides.rd.do(Unknown Source)
com.aspose.slides.rd.do(Unknown Source)
com.aspose.slides.bg.do(Unknown Source)
com.aspose.slides.vf.do(Unknown Source)
com.aspose.slides.akz.do(Unknown Source)
com.aspose.slides.agb.do(Unknown Source)
com.aspose.slides.agb.do(Unknown Source)
com.aspose.slides.agb.do(Unknown Source)
com.aspose.slides.Presentation.do(Unknown Source)
com.aspose.slides.Presentation.do(Unknown Source)
com.aspose.slides.Presentation.save(Unknown Source)
com.aspose.slides.examples.P2X.main(P2X.java:41)
at com.aspose.slides.Collections.Generic.Dictionary.get_Item(Unknown Source)
at com.aspose.slides.oz.do(Unknown Source)
at com.aspose.slides.oz.do(Unknown Source)
at com.aspose.slides.apb.do(Unknown Source)
at com.aspose.slides.apb.do(Unknown Source)
at com.aspose.slides.apb.do(Unknown Source)
at com.aspose.slides.apb.(Unknown Source)
at com.aspose.slides.TextFrame.do(Unknown Source)
at com.aspose.slides.TextFrame.do(Unknown Source)
at com.aspose.slides.TextFrame.void(Unknown Source)
at com.aspose.slides.r.do(Unknown Source)
at com.aspose.slides.rd.do(Unknown Source)
at com.aspose.slides.rd.do(Unknown Source)
at com.aspose.slides.bg.do(Unknown Source)
at com.aspose.slides.vf.do(Unknown Source)
at com.aspose.slides.akz.do(Unknown Source)
at com.aspose.slides.agb.do(Unknown Source)
at com.aspose.slides.agb.do(Unknown Source)
at com.aspose.slides.agb.do(Unknown Source)
at com.aspose.slides.Presentation.do(Unknown Source)
at com.aspose.slides.Presentation.do(Unknown Source)
at com.aspose.slides.Presentation.save(Unknown Source)
at com.aspose.slides.examples.P2X.main(P2X.java:41)

@vin.wang,
Welcome to our community! Thank you for the issue description. To investigate this case, please share and specify the following:

  • The code example reproducing the issue
  • The version of Aspose.Slides you used

But first, please check the issue with the latest version of Aspose.Slides.

hi @Andrey_Potapov, source code as follows, and I tried the latest version, the same error occurs.

public class P2X
{
    public static void main(String[] args)
    {
        System.out.println("in path: " + args[0] + ",out path: " + args[1]);
        try {
            File dir = new File(System.getProperty("user.dir"));
            String licensePath = dir.toString() + File.separator + "license" + File.separator + "Aspose.Total.Product.Family.lic";
            File licenseFile = new File(licensePath);
            if (licenseFile.exists()) {
                License license = new License();
                license.setLicense(licenseFile.getAbsolutePath());
            }
            String dataDir = args[0];
            String outDir = args[1];
            File file = new File(dataDir);
            if (file.isDirectory()) {
                File[] files = file.listFiles();
                long startTime = System.currentTimeMillis();
                for (File f : files) {
                    String name = f.getName();
                    System.out.println("file name: " + name);
                    Presentation pres = new Presentation(dataDir + File.separator + name);
                    String saveName = outDir + File.separator + name + ".pptx";
                    pres.save(saveName, SaveFormat.Pptx);
                    System.out.println("Document converted to pptx successfully. File saved at " + saveName);
                }
                System.out.printf("%s%10d%s", "time seconds: ", System.currentTimeMillis() - startTime, " ms ");
            }
        }catch (Exception e){
            e.printStackTrace();
        }

    }
}

@vin.wang,
I’ve logged the issue in our tracking system with ID SLIDESJAVA-38532. Our development team will investigate this case. I will inform you about any progress.

@vin.wang,
Our development team investigated the issue. It seems to be your stack trace doesn’t match the latest version of Aspose.Slides. Could you check this again and share a stack trace with Aspose.Slides 21.4, please?

@Andrey_Potapov I tried the latest version of Aspose.Slides 21.4,and got the following error.

class com.aspose.slides.exceptions.KeyNotFoundException: The given key was not present in the dictionary.
com.aspose.slides.Collections.Generic.Dictionary.get_Item(Unknown Source)
com.aspose.slides.pd.do(Unknown Source)
com.aspose.slides.pd.do(Unknown Source)
com.aspose.slides.apo.do(Unknown Source)
com.aspose.slides.apo.do(Unknown Source)
com.aspose.slides.apo.do(Unknown Source)
com.aspose.slides.apo.<init>(Unknown Source)
com.aspose.slides.TextFrame.do(Unknown Source)
com.aspose.slides.TextFrame.do(Unknown Source)
com.aspose.slides.TextFrame.void(Unknown Source)
com.aspose.slides.r.do(Unknown Source)
com.aspose.slides.rr.do(Unknown Source)
com.aspose.slides.rr.do(Unknown Source)
com.aspose.slides.bj.do(Unknown Source)
com.aspose.slides.vt.do(Unknown Source)
com.aspose.slides.ale.do(Unknown Source)
com.aspose.slides.agq.do(Unknown Source)
com.aspose.slides.agq.do(Unknown Source)
com.aspose.slides.agq.do(Unknown Source)
com.aspose.slides.Presentation.do(Unknown Source)
com.aspose.slides.Presentation.do(Unknown Source)
com.aspose.slides.Presentation.save(Unknown Source)
com.aspose.slides.examples.P2X.main(P2X.java:41)
        at com.aspose.slides.Collections.Generic.Dictionary.get_Item(Unknown Source)
        at com.aspose.slides.pd.do(Unknown Source)
        at com.aspose.slides.pd.do(Unknown Source)
        at com.aspose.slides.apo.do(Unknown Source)
        at com.aspose.slides.apo.do(Unknown Source)
        at com.aspose.slides.apo.do(Unknown Source)
        at com.aspose.slides.apo.<init>(Unknown Source)
        at com.aspose.slides.TextFrame.do(Unknown Source)
        at com.aspose.slides.TextFrame.do(Unknown Source)
        at com.aspose.slides.TextFrame.void(Unknown Source)
        at com.aspose.slides.r.do(Unknown Source)
        at com.aspose.slides.rr.do(Unknown Source)
        at com.aspose.slides.rr.do(Unknown Source)
        at com.aspose.slides.bj.do(Unknown Source)
        at com.aspose.slides.vt.do(Unknown Source)
        at com.aspose.slides.ale.do(Unknown Source)
        at com.aspose.slides.agq.do(Unknown Source)
        at com.aspose.slides.agq.do(Unknown Source)
        at com.aspose.slides.agq.do(Unknown Source)
        at com.aspose.slides.Presentation.do(Unknown Source)
        at com.aspose.slides.Presentation.do(Unknown Source)
        at com.aspose.slides.Presentation.save(Unknown Source)
        at com.aspose.slides.examples.P2X.main(P2X.java:41)

@vin.wang,
I passed your information to our development team. I will inform you about any progress.

@vin.wang,
Our development team investigated the issue. To fix this exception in Aspose.Slides for Java 21.4/21.5, you should add a font with CJK characters (for example, Dejavu) to OS. A full fix will be available in Aspose.Slides for Java 21.6

.

@Andrey_Potapov I’m glad to hear that, thanks a lot.

The issues you have found earlier (filed as SLIDESJAVA-38532) have been fixed in this update.