Created attachment 35924 [details] Simple application to generate slidedeck and supporting files Feature request to add SVG image support. This is the only way of including vector graphics in a .pptx that is valid across platforms. Other vector graphics formats are valid on windows (EMF, PDF) but not on linux (EPS).
Created attachment 35933 [details] Patch to add SVG image support to XSLF. Patch to add SVG image support to XSLF. A PNG version of the image is also created using Batik and included in the slidedeck. I've verified the output on Windows where the SVG is displayed, and on linux and MacOS where the PNG is displayed. The code I've added is really a hack and is far from production quality. Submitting this patch just in case its useful to someone doing real development on this feature.
Thank you for sharing your code. I just had a glimpse on it, as I'm busy fixing a regression on #53176. As we usually try to minimize dependencies (to Batik), I'll try to encapsulate the svg-rendering, e.g. by providing a preview picture when adding the svg or by implementing the ImageRenderer (see BitmapImageRenderer) on rendering the slides.
Hi Andreas, Ritesh.
Was wondering what is the status of this patch? It would be awesome to have native SVG support through POI. As currently we need to rasterize vectors to pngs. If there's something I can do to help push this along please let me know. Otherwise, thanks for the support and development of this library
(In reply to Michael Kendra from comment #4) > As currently we need to rasterize vectors to > pngs. SVG support in Office is relatively new ... If those pictures are in EMF format, you might want to check the emf branch. I've done some modifications there on how the renderers are executed, so I'll merge that first before careing about the SVG enhancement. I think it's OK to compile against Batik, but then omit the jar/reference in our dist. But we need to make sure, that a missing reference is handled gracefully.
Partly implemented via r1849030 You can add a SVG image on top of a preview image via XSLFPictureShape.setSvgImage() or use the convenience method XSLFPictureShape.addSvgImage(). See also the junit test renderSvgImage() in http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java?view=markup I need to merge the EMF branch first, which contains a different image renderer loading, before the slide rendering works - currently only adding the svg image (incl. thumbnail generation) works. I omitted the dependency to batik-all ("-all", because nearly all batik modules are need), xml-apis-ext and xmlgraphics-commons in the dist files as I consider this not as a core feature and it's easy for users to add batik-all to their maven/gradle build ... I'll add a note to the component overview.
Added the slide rendering via r1849046