Created attachment 34662 [details] sample of result from slide 2 and 16 that have issue Hi, We are having problem to use POX XSLF with rendering background colour and rendering shape that overlayed by transparent image? We test our code to render http://www.slideshare.net/sdeeg/spring-boot into image/svg but - the background is rendered as grey instead of white. - a rectangular shape that placed behind a PNG image is rendered. In this case can be argued that part of shape is behind the PNG image but some of them only behind transparent section of the image, but Powerpoint and Keynote application do not render them Using: ------ POI 3.16-beta1 Batik 1.7 Code to test: ------------- String presentation = // your downloaded presentation file String dir = "/tmp/" + UUID.randomUUID().toString(); Files.createDirectory(Paths.get(dir)); XMLSlideShow ppt = new XMLSlideShow(new FileInputStream(presentation)); int i = 1; for (XSLFSlide slide : ppt.getSlides()) { String filename = dir + "/slide-" + i + ".svg"; org.w3c.dom.Document doc = org.apache.batik.dom.svg.SVGDOMImplementation.getDOMImplementation() .createDocument("http://www.w3.org/2000/svg", "svg", null); //Use Batik SVG Graphics2D driver SVGGeneratorContext svgContext = SVGGeneratorContext.createDefault(doc); SVGGraphics2D graphics = new SVGGraphics2D(svgContext, false); graphics.setBackground(Color.WHITE); graphics.setSVGCanvasSize(ppt.getPageSize()); // draw stuff. All the heavy-lifting happens here slide.draw(graphics); // save the result. try (final OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")) { graphics.stream(out, true); out.flush(); } i++; } I have tried to fix the background image but seems like setting up the fill colour is not the correct way to do. I also debug the drawing method for the layers for shape issue, i can see that the order of drawing is correct that the bottom most layer is rendered first but seems like the issue lay in the rectangular shape is rendered first without considering there is another image that have bounding rectangle on top of it (even though transparent). If anyway can point out the correct direction to fix the issue going to be great. Thanks,
I don't have a LinkedIn account to download something from slideshare ... and I refuse to register! ... and I don't want to spent more than 15 minutes on how to download the original .pptx without registration ... If it's ok copyright-wise and size-wise, please upload that slideshow to bugzilla ... or if not, send it to my apache email. Andi
The file is also available at [1] - I've seen a few rendering issues and try to cope with them (... hopefully soon ...) As we've also uploaded files from tika runs, I probably will upload it also to our test corpus, [1] https://people.apache.org/~kiwiwings/spring-boot.pptx
fixed a few rendering issues with r1782096 and tested it with batik too added support for slide numbers to XSLF/HSLF you should add the wingding.ttf to awt for correct bullet rendering - at least with png output please give it a try
Hi Andreas, I had a quick test from the nightly built yesterday and from my observation What works: - background colour issue is fixed - the fix for the page works on PPTx export but appear as asterisk if exported from PPT file What do not work: - rectangle border still exist (slide-16.svg) - (NEW) white background in the middle 1st page is not rendered (slide-1.svg) . This is quite weird issue, if I save the PPTx file into pre-2003 PPT format then the white background is rendered correctly. I also tested this one rendered correctly in 3.16-beta2 (samples in the link below) Links: https://www.dropbox.com/sh/ir981cxkutmkxps/AADTcj17KwOnpm26JJBMjgj_a?dl=0
I've added a few more fixes via r1782706 and r1782712 Both XSLF (support for themes) and HSLF (support for shapes) still have quite a few problems ... I leave it up to you, to decide when to close the bug ... I probably close it before we push POI 3.16 final ...
Thanks Andreas, Seems like your latest fixes work for the main issue that I reported for this bug