Search code examples
gwtaspose-slides

Aspose.slides api is not working in GWT project


I’m trying to use Aspose.Slides in my GWT project for this I have placed this aspose-slides-18.9-jdk16.jar file under WEB-INF/lib and i tried the below given code but I cannot compile my project and ppt file is not created

Presentation srcPres = new Presentation("F:\\AsposeSlides\\Src1.pptx");
Presentation destPres = new Presentation("F:\\AsposeSlides\\Src2.pptx");
ISlideCollection slds = destPres.getSlides();

slds.insertClone(2, srcPres.getSlides().get_Item(2));

destPres.save("F:\\AsposeSlides\\outputPres.pptx", SaveFormat.Pptx);

Can anyone suggest me an idea to resolve this issue ?


Solution

  • You can't use java libraries in the client side of a GWT project. You can only use GWT libraries in the client side of a GWT project.

    I can see this library is trying to save a file to disk, this can never work in GWT client side.

    The solution is to use this code in a servlet (in the server directory of your project structure). Then call that servlet from the client side, and stream back the file contents from the servlet to the client.