Bug 56519

Summary: XSLFSlide.draw is not working with text embeded in PPTX
Product: POI Reporter: Nirbhay K <nirbhay>
Component: XSLFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: major    
Priority: P2    
Version: 3.10-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Nirbhay K 2014-05-13 12:32:53 UTC
I tried converting slides into png.

It exported png, but the exported png contains only background. It is not rendering text in it, also the exported background scale is too big that only 1/4 of the image is rendered as png.

Attached is the PPTX and the java code I am using.


//java code

        FileInputStream is = new FileInputStream("KEY02.pptx");
        XMLSlideShow ppt = new XMLSlideShow(is);
        is.close();

        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);

            //save the output
            FileOutputStream out = new FileOutputStream("slide-" + (i + 1) + ".png");
            javax.imageio.ImageIO.write(img, "png", out);
            out.close();
        }
Comment 1 Nirbhay K 2014-05-13 12:37:26 UTC
It is more than 2 mb. So I have uploaded PPTX it to my dropbox.

https://www.dropbox.com/s/j52s2e6a4eieavh/KEY02.pptx
Comment 2 Nirbhay K 2014-05-13 12:44:56 UTC
When I save it as powerpoint 97-2004 format, and use HSFL module to render png, it works like a charm.
Comment 3 Andreas Beeker 2015-08-09 22:51:42 UTC
Fixed as part of r1694925
this contains also other rendering fixes, a common SlideFactory and
PPTX2PNG also handles .ppt now
the rendering still doesn't support wmf, so the logo in the lower right corner 
is not rendered
the text on the slide had actually a gradient fill, therefore it was rendered 
black (default) up till now