Rendering slideshows, WMF, EMF and EMF+
Rendering slideshows, WMF, EMF and EMF+
For rendering slideshow (HSLF/XSLF), WMF, EMF and EMF+ pictures, POI provides an utility class PPTX2PNG:
Instructions to run
Download the current nightly and for SVG/PDF the additional dependencies.
Execute the java command (Unix-paths needs to be replaced for Windows - use "-charset" for non-western WMF/EMFs):
If you want to use the renderer on the module path (JPMS) there a currently a few more steps necessary:
- Create a build project using Maven, Gradle or your favorite build tool.
- Alternatively, download the jars from https://repo1.maven.org/maven2/org/apache/poi/
- Exclude poi-ooxml-full-5.3.0.jar,poi-javadoc-5.3.0.jar and auxiliary/xml-apis-1.4.01.jar (Java 11+) into new subdirectory "unused"
- Move all other jars in current directory into a new subdirectory "poi"
- Remove auxiliary/batik-script-1.14.jar:/META-INF/services/org.apache.batik.script.InterpreterFactory - see BATIK-1260
- Invoke PPTX2PNG:
java --module-path poi:lib:auxiliary:ooxml-lib --module org.apache.poi.ooxml/org.apache.poi.xslf.util.PPTX2PNG -format png -fixside long -scale 1000 file.pptx
Integrate rendering in your code
#1 - Use PPTX2PNG via file or stdin
For file system access, you need to save your slideshow/WMF/EMF/EMF+ first to disc and then call PPTX2PNG.main() with the corresponding parameters.
for stdin access, you need to redirect System.in before: