Sign In  Sign Up Live-Chat

Trouble with cloning and thumbnails with certain slides

Last post 07-08-2008, 10:24 AM by msfaiz. 16 replies.
Page 1 of 2 (17 items)   1 2 Next >
Sort Posts: Previous Next
  •  07-05-2007, 11:12 AM 82853

    Trouble with cloning and thumbnails with certain slides

    Attachment: Present (inaccessible)
    Hello,

    We are having some trouble with some of the slides we're processing with Aspose.Slides for Java.  We have a file "Non-MD-MM Mandatory Deck.ppt" which I'm attaching.  We try to split it into one ppt file per slide, and this usually works but on this deck slide 17 fails with an exception com.aspose.slides.PptEditException: Slide cloning error.  That is the first problem.

    The 2nd problem is that when we get thumbnails for slides 8, 12, and 16, the images are missing some of the graphics from the original slides. 

    Here's the code we use to split the ppt:
                Presentation p = new Presentation(new FileInputStream(inputFile));
                LOG.info("file has " + p.getSlides().size() + " slides");

                for (int i=0; i<p.getSlides().size(); i++) {
                    Slide slide = p.getSlideByPosition(i+1);
                    if (slide!=null) {
                        LOG.info("saving slide " + (i+1));
                        TreeMap map = new TreeMap();
                        Presentation newPresentation = new Presentation();
                        p.cloneSlide(slide, 1, newPresentation, map);
                        newPresentation.getSlides().removeAt(0);
                        File targetFile = new File(targetDir, baseName + "-" + (i + 1) + ".ppt");
                        newPresentation.write(new FileOutputStream(targetFile));
                        newPresentation = null;
                    }
                }

    And here's the code we're using to get the jpg's:

    Presentation p = new Presentation(new FileInputStream(inputFile));
                Slide s = p.getSlideByPosition(1);
                BufferedImage slideImage = s.getThumbnail((float)2.0, (float)2.0);
                File outputFile = new File(targetDir, baseName + ".jpg");
                LOG.info("writing to " + outputFile.getName());
                ImageIO.write(slideImage, "jpg", outputFile);

    PPT and jpg's attached.

    Thanks!

    Greg
     
  •  07-05-2007, 3:02 PM 82875 in reply to 82853

    Re: Trouble with cloning and thumbnails with certain slides

    For your second question, please see this post. Does it help?

    http://www.aspose.com/Community/Forums/82874/ShowThread.aspx#82874


    Many Thanks and Kind Regards,

    Shakeel Faiz
    Support Engineer
    Aspose Tyumen Team
     
  •  07-05-2007, 3:12 PM 82876 in reply to 82875

    Re: Trouble with cloning and thumbnails with certain slides

    Hello-

    So you think if I add the Metafiles component, Aspose.Slides will be able to export the graphs to jpg?  I think the graphs are embedded Excel object, does Metafiles work with these?

    Thanks again,

    Greg
     
  •  07-05-2007, 3:37 PM 82879 in reply to 82876

    Re: Trouble with cloning and thumbnails with certain slides

    Hello-

    Well I downloaded Metafiles, and the slides where the graphs were being lost before are now working, thank you for the pointer to that component.  Unfortunately, I'm still getting the exception on slide 17 of that presentation (com.aspose.slides.PptEditException: Slide cloning error.).   Have you had any luck tracking that down?

    Greg
     
  •  07-06-2007, 6:35 AM 82973 in reply to 82879

    Re: Trouble with cloning and thumbnails with certain slides

    I have done a little change in your code. You should not use size() method of Slides, instead use getLastSlidePosition() method. The reason being is Slides also contains title masters besides normal slide.

    int sldCount=p.getSlides().getLastSlidePosition();

    for (int i=0; i<sldCount; i++) {

    Slide slide = p.getSlideByPosition(i+1);

    if (slide!=null) {

    TreeMap map = new TreeMap();

    Presentation newPresentation = new Presentation();

    p.cloneSlide(slide, 1, newPresentation, map);

    newPresentation.getSlides().removeAt(0);

    File targetFile = new File(targetDir, baseName + "-" + (i + 1) + ".ppt");

    newPresentation.write(new FileOutputStream(targetFile));

    newPresentation = null;

    }

    }

    I am also getting error on slide 17, I have reported it for a fix.


    Many Thanks and Kind Regards,

    Shakeel Faiz
    Support Engineer
    Aspose Tyumen Team
     
  •  07-06-2007, 7:45 AM 82981 in reply to 82973

    Re: Trouble with cloning and thumbnails with certain slides

    Thank you for getting back to me on this, I will make that change in my code.  How long does it usually take for something like this to get fixed when you report it for a fix?  I am just asking so I know what to tell my client when they ask when this will be fixed.  Thanks again,

    Greg
     
  •  07-06-2007, 8:24 AM 82988 in reply to 82981

    Re: Trouble with cloning and thumbnails with certain slides

    Normally, Aspose.Slides with new bug fixes is released every weekend. So you can expect it on next weekend.

     

    I will inform you by posting here and you can also check for new fixes here.

    http://www.aspose.com/Community/Blogs/


    Many Thanks and Kind Regards,

    Shakeel Faiz
    Support Engineer
    Aspose Tyumen Team
     
  •  07-03-2008, 4:06 PM 134245 in reply to 82973

    Trouble with cloning slides

    I am getting the following error too when i was trying to clone the slides with the following code.

     

    com.aspose.slides.Presentation part = new com.aspose.slides.Presentation(mv.getFileBlob().getBinaryStream());

    com.aspose.slides.Slides slides= part.getSlides();

    TreeMap ids = new TreeMap();

    for(int s =0;s<slides.getLastSlidePosition();s++){

    ids.clear();

    preso.cloneSlide(part.getSlides().get(s),preso.getSlides().getLastSlidePosition()+1,preso,ids);

    }

    java.lang.Exception: com.aspose.slides.PptEditException: Slide cloning error.
            at com.cisco.ibsg.cbk.business.BusinessFacade.assemblePresentation(BusinessFacade.java:775)
            at com.cisco.ibsg.cbk.actions.DownloadPresentationAction.execute(DownloadPresentationAction.java:47)
            at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
            at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
            at com.cisco.ibsg.cbk.framework.CustomRequestProcessor.process(CustomRequestProcessor.java:106)
            at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
            at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
            at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
            at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
            at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
            at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
            at java.lang.Thread.run(Thread.java:595)
    Caused by: com.aspose.slides.PptEditException: Slide cloning error.
            at com.aspose.slides.Presentation.cloneSlide(SourceFile:1371)
            at com.cisco.ibsg.cbk.business.BusinessFacade.assemblePresentation(BusinessFacade.java:757)
            ... 22 more
    Caused by: java.lang.NullPointerException
            at com.aspose.slides.Presentation.cloneSlide(SourceFile:1349)

     
  •  07-04-2008, 1:33 PM 134403 in reply to 134245

    Re: Trouble with cloning slides

    Dear chand,

     

    Thanks for considering Aspose.Slides for JAVA.

     

    You should pass a new TreeMap object, no matter you clear it.

     

    Also, you need to use cloneSlide method of correct presentation.

     

    Further, your loop should start from 1 till getLastSlidePosition

     

    The code will look like this.

     

    com.aspose.slides.Presentation preso= new com.aspose.slides.Presentation();

     

    com.aspose.slides.Presentation part = new com.aspose.slides.Presentation(mv.getFileBlob().getBinaryStream());

     

    com.aspose.slides.Slides slides= part.getSlides();

     

    for(int s =1;s<=slides.getLastSlidePosition();s++){

     

    part.cloneSlide(part.getSlides().get(s),preso.getSlides().getLastSlidePosition()+1,preso,new TreeMap());

     

    }


    Many Thanks and Kind Regards,

    Shakeel Faiz
    Support Engineer
    Aspose Tyumen Team
     
  •  07-04-2008, 1:45 PM 134404 in reply to 134403

    Re: Trouble with cloning slides

    Hi,

    Thanks for the reply.

    I still get the same error after starting the iteration with 1.

     

     
  •  07-04-2008, 1:49 PM 134406 in reply to 134404

    Re: Trouble with cloning slides

    Make sure, you follow my all instructions, TreeMap one, the order of presentation in cloneSlide method.
    Many Thanks and Kind Regards,

    Shakeel Faiz
    Support Engineer
    Aspose Tyumen Team
     
  •  07-05-2008, 6:55 PM 134435 in reply to 134406

    Re: Trouble with cloning slides

    Hi Shakeel,

    Thanks for the quick response.I tried changing the presentation and adding the new TreeMap.Now ia m getting the PPT but it's size and order of the slides it is generating is not correct.Please let me know what could be the issue here.

     

    Thanks

    Chand

     
  •  07-07-2008, 6:54 AM 134511 in reply to 134435

    Re: Trouble with cloning slides

    Dear Chand,

    To make the size of the slide match the source ppt, you can use Presentation.setSlideSize() method.

    e.g

    Point pntSize=new Point((int)sourcePres.getSlideSize().getX(), (int)sourcePres.getSlideSize().getY());

    targetPres.setSlideSize(pntSize);

    You can also change the position of the slide via Slide.setSlidePosition() method.

    Also, if your order of slide is incorrect because of one default slide added by Aspose.Slides. You can save its reference and then delete it after your processing is done.

    To delete slide you can use Presentation.getSlides().remove(firstSlide) method.


    Many Thanks and Kind Regards,

    Shakeel Faiz
    Support Engineer
    Aspose Tyumen Team
     
  •  07-07-2008, 12:09 PM 134572 in reply to 134511

    Re: Trouble with cloning slides

    Hi Shakeel,

    Thanks for the quick response,i am seeing the following error quite often.Please let me know what could be the root cause for this.

    java.lang.OutOfMemoryError: Java heap space
    com.aspose.slides.W.<init>(SourceFile:54)
    com.aspose.slides.W.<init>(SourceFile:42)
    com.aspose.slides.bi.<init>(SourceFile:117)
    com.aspose.slides.eB.do(SourceFile:221)
    com.aspose.slides.bd.do(SourceFile:81)
    com.aspose.slides.Presentation.write(SourceFile:604)

     

    Thanks

    Ajay

     
  •  07-07-2008, 5:51 PM 134625 in reply to 134435

    Re: Trouble with cloning slides

    Hi Shakeel,

    Once agian Thanks for the quick response.While cloning the slides i am missing few slides is that could be due to Master Slide also the alignment of the Text images and the order of slides is incorrect.Can you please point me to the correct samples.I will appreciate your support.

     

    Thanks

    chand

     
Page 1 of 2 (17 items)   1 2 Next >
View as RSS news feed in XML