Hi,
our company is going to buy the java version of the product Aspose-Slide.
So before that I’ve testet the demo-version of Aspose-Slide with the following code in eclipse with tomcat integration, my goal was to write a new ppt file with a video frame slide included.
/package com.aspose.demo;/
import javax.servlet.;
import javax.servlet.http.;
import java.io.;
import java.util.;
import com.aspose.*;
import com.aspose.slides.Paragraph;
import com.aspose.slides.Placeholders;
import com.aspose.slides.Presentation;
import com.aspose.slides.Shapes;
import com.aspose.slides.Slide;
import com.aspose.slides.Slides;
import com.aspose.slides.TextFrame;
import com.aspose.slides.TextHolder;
import java.net.URL;
public class TestAspose extends HttpServlet {
private static final long serialVersionUID = 1L;
private static final String CONTENT_TYPE = “text/html; Latin-1”;
//Initialize global variables
public void init() throws ServletException {
}
//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
out.println("");
out.println("\n" +
“Aspose.Slides Web Template demo\n” +
“<meta http-equiv=“Content-Type” content=“text/html; char-set=utf-8”>\n” +
“<link href=“http://www.aspose.com/aspose.css” type=“text/css” rel=“stylesheet”>\n” +
“”);
out.println("<body background=“http://www.aspose.com/images/imgBack.gif”>");
String header = “<iframe src=“http://www.aspose.com/Header/Header.aspx” frameborder=“0” width=“100%” scrolling=“no”>”;
out.println(header);
out.println("<p class=“i1”>Welcome to the Aspose.Slides for Java Featured Demos!
out.println("<p class=“i1”> “);
out.println(”<p class=“i1”>The demo loads PowerPoint presentation, modifies and displayes it “);
out.println(”");
out.println("<input type=submit value=“Run DEMO”>");
out.println("</form");
System.out.println(“51”);
String footer = “<div id=“footer”>” +
“
<a href=“http://www.aspose.com/Corporate/Aspose/Contactaspose.html”>We guarantee a prompt response to any inquiry!
” +“”;
out.println(footer);
}
//Process the HTTP Post request
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Presentation pres;
FileInputStream source = null;
FileOutputStream destination = null;
PrintStream dataOut = null;
DataInputStream dataIn;
System.out.println(“67”);
try {
ServletContext context = request.getSession().getServletContext();
String realContextPath = context.getRealPath(request.getContextPath());
int pos = realContextPath.lastIndexOf("\");
realContextPath = realContextPath.substring(0, pos);
String pptPath = realContextPath + “\” + “demo.ppt”;
String destPath = realContextPath + “\” + “modified.ppt”;
source = new FileInputStream(pptPath);
destination = new FileOutputStream(destPath);
System.out.println(“80”);
pres = new Presentation(new FileInputStream(pptPath));
System.out.println(“82”);
//Accessing a slide using its slide position
Slide slide = pres.getSlideByPosition(1);
//Adding the video frame into the slide
slide.getShapes().addVideoFrame(1900,1100, 2000, 2000, “H:\demo.avi”);
//Writing the presentation as a PPT file
// pres.write(new FileOutputStream(new File(“modified.ppt”)));
pres.write(destination);
System.out.println(“File Createt!”);
source.close();
destination.close();
}
catch(Exception ex)
{
System.out.println(ex.toString());
}
}
}
But without success because I get a exception like that after running it:
java.lang.ClassNotFoundException: com.aspose.slides.PresentationThe Problem is that the Presentation Class can not be found although the library for that is imported.
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1363)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1209)
java.lang.ClassLoader.loadClassInternal(Unknown Source)
TestAspose.doPost(TestAspose.java:81)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
I’ve already integrated the library “com.aspose.slides” from the demo-version for the runtime process in eclipse and also followed the instruction in the readme fille about installing JAI (Java Advanced Imaging API) and JAI Image I/O, but it didn’t help.
It would be great if you could help me by solving the problem…
Thank you very much