i want to convert ppt file into image using apache lib in android studio.
But i'm not able to read the presentation file.
In my project i have added following jar in lib folder:
poi-3.9-20121203.jar'
poi-ooxml-3.9-20121203.jar'
java-rt-jar-stubs-1.5.0 3.jar'
poi-ooxml-schemas-3.9-20121203.jar'
dom4j-1.6.1.jar'
xmlbeans-2.3.0.jar')
and added following code in onCreate(),

File sdDir = Environment.getExternalStorageDirectory();

            //creating an empty presentation
            File file=new File(sdDir+"TestPPT.pptx");
            XMLSlideShow ppt = new XMLSlideShow(new FileInputStream(file));

            //getting the dimensions and size of the slide
            Dimension pgsize = ppt.getPageSize();
            XSLFSlide[] slide = ppt.getSlides();

            for (int i = 0; i < slide.length; i++) {
                BufferedImage img = new BufferedImage(pgsize.width,
pgsize.height,BufferedImage.TYPE_INT_RGB);
                Graphics2D graphics = img.createGraphics();

                //clear the drawing area
                graphics.setPaint(Color.white);
                graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width,
pgsize.height));

                //render
                slide[i].draw(graphics);
            }

            //creating an image file as output
            FileOutputStream out = new FileOutputStream("ppt_image.png");
            javax.imageio.ImageIO.write(img, "png", out);
            ppt.write(out);

            System.out.println("Image successfully created");
            out.close();

but it will gives me following error:

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException:
> java.lang.RuntimeException:
> com.android.ide.common.process.ProcessException:
> java.util.concurrent.ExecutionException:
> com.android.ide.common.process.ProcessException:
> org.gradle.process.internal.ExecException: Process 'command
> '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java''
> finished with non-zero exit value 1

could you please help me on this error?

Thank you,
Pratibha mache 





--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/want-to-convert-ppt-file-into-image-using-apache-lib-in-android-studio-tp5722897.html
Sent from the POI - Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to