Issue: Unable to convert from PPTX to ODP. Getting the following exception:
Size of loaded PPTX file : 277 kb
Exception in thread "main" java.lang.NullPointerException
at com.aspose.slides.n7g.ii(Unknown Source)
at com.aspose.slides.n7g.ii(Unknown Source)
at com.aspose.slides.n7g.ii(Unknown Source)
at com.aspose.slides.x8v.ii(Unknown Source)
at com.aspose.slides.xg.ii(Unknown Source)
at com.aspose.slides.xg.mh(Unknown Source)
at com.aspose.slides.in6.ii(Unknown Source)
at com.aspose.slides.a9q.kp(Unknown Source)
at com.aspose.slides.a9q.ii(Unknown Source)
at com.aspose.slides.Presentation.ii(Unknown Source)
at com.aspose.slides.Presentation.ii(Unknown Source)
at com.aspose.slides.Presentation.save(Unknown Source)
at TestODP.main(TestODP.java:30)
Test File to reproduce the issue.
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import com.aspose.slides.Presentation;
public class TestODP {
public static void main(String args[])throws Exception{
String filename = "final.odp";
Path path = Paths.get(filename);
InputStream fileIS = new FileInputStream("./Test.pptx");
BufferedInputStream bis = new BufferedInputStream(fileIS);
bis.mark(2147483647);
long size = getSize(bis);
bis.reset();
System.out.println("Size of loaded PPTX file : "+size/1024+" kb\n\n");
Presentation presentation = null;
int saveFormat = 6; //ODP
presentation = new Presentation(bis);
presentation.save(filename, saveFormat);
InputStream is = Files.newInputStream(path);
BufferedInputStream bisODP = new BufferedInputStream(is);
bisODP.mark(Integer.MAX_VALUE);
long sizeODP = getSize(bisODP);
bisODP.reset();
}
public static long getSize(InputStream is) {
long size = 0L;
try {
int bufSize = 4096;
byte[] b = new byte[bufSize];
for(int read = 1; (read = is.read(b)) >= 0; size += (long)read) {
}
} catch (Exception var6) {
}
return size;
}
}
Sample PPTX FIle:
Test.pptx.zip (261.9 KB)
Sample pptx : HERE