Bug 56519 - XSLFSlide.draw is not working with text embeded in PPTX
Summary: XSLFSlide.draw is not working with text embeded in PPTX
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSLF (show other bugs)
Version: 3.10-FINAL
Hardware: PC All
: P2 major with 4 votes (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-13 12:32 UTC by Nirbhay K
Modified: 2015-08-09 22:51 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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