i’m having trouble converting pptx file to PDF,
Exception :
com.aspose.slides.kt: The file is ZIP archive. It can be Microsoft PowerPoint 2007 PPTX presentation.
here is my very simple code:
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.InputStream;
import com.aspose.cells.SaveFormat;
import com.aspose.cells.Workbook;
import com.aspose.slides.Presentation;
public class toSlide {
public static void main(String[] args) throws Exception {
convertingExcelStreamtoPDF();
}
private static FileOutputStream slideInputStreamToPDFOutputStream(InputStream stream) throws Exception {
try {
Presentation pres = new Presentation(stream);
stream.close();
ByteArrayOutputStream dstStream = new ByteArrayOutputStream();
pres.save(dstStream, SaveFormat.PDF);
FileOutputStream output = new FileOutputStream("444.pdf");
output.write(dstStream.toByteArray());
return output;
} catch (Exception e) {
System.out.println(e.getCause());
throw new Exception(e.getCause());
}
}
public static void convertingExcelStreamtoPDF() throws Exception {
InputStream stream = new FileInputStream("test2.pptx");
FileOutputStream output = slideInputStreamToPDFOutputStream(stream);
output.close();
}
}
I am using aspose-slides-8.6.0-java
the exception is thrown on this line:
Presentation pres = new Presentation(stream);
This message was posted using Email2Forum by Awais Hafeez.