v8.1.25
I'm trying to build a proof of concept for breaking a Powerpoint file into images of the slides.
Unfortunately, when I try to draw the graphic, it throws the exception listed in the title. I'm thinking it was something deprecated and removed in Java 11, but I'm willing to be wrong.
I'd upload the generic 'Welcome to Powerpoint' file, but .pptx is not on the allowed extension list.
from java.awt import Color
from java.awt.geom import Rectangle2D
from java.awt.image import BufferedImage
from java.io import File;
from java.io import FileInputStream
from java.io import FileOutputStream
from org.apache.poi.xslf.usermodel import XMLSlideShow
from javax.imageio import ImageIO
filePath = "C:/Test/test.pptx"
pathList = filePath.split('/')
fileNameList = pathList[-1].split('.')
baseImagePath = '{}/{}_{}.{}'.format('/'.join(pathList[:-1]), '.'.join(fileNameList[:-1]), '{:02d}', 'png')
ppt = XMLSlideShow(FileInputStream(filePath))
pageSize = ppt.pageSize
slides = ppt.slides
for ndx, slide in enumerate(slides):
image = BufferedImage(pageSize.width, pageSize.height,BufferedImage.TYPE_INT_RGB)
imagePath = baseImagePath.format(ndx+1)
graphics = image.graphics
graphics.setPaint(Color.white)
graphics.fill(Rectangle2D.Float(0, 0, pageSize.width, pageSize.height))
slide.draw(graphics)
fileOut = FileOutputStream(imagePath)
ImageIO.write(image, 'png', fileOut)
fileOut.close()
Java Traceback:
Traceback (most recent call last):
File "<input>", line 29, in <module>
at org.apache.poi.xslf.usermodel.XSLFSimpleShape.getGeometry(XSLFSimpleShape.java:729)
at org.apache.poi.sl.draw.DrawSimpleShape.computeOutlines(DrawSimpleShape.java:381)
at org.apache.poi.sl.draw.DrawSimpleShape.draw(DrawSimpleShape.java:74)
at org.apache.poi.sl.draw.DrawSheet.draw(DrawSheet.java:71)
at org.apache.poi.sl.draw.DrawSheet.draw(DrawSheet.java:50)
at org.apache.poi.sl.draw.DrawSheet.draw(DrawSheet.java:50)
at org.apache.poi.sl.draw.DrawSlide.draw(DrawSlide.java:41)
at org.apache.poi.xslf.usermodel.XSLFSlide.draw(XSLFSlide.java:373)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at org.python.core.Py.JavaError(Py.java:547)
at org.python.core.Py.JavaError(Py.java:538)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:192)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:208)
at org.python.core.PyObject.__call__(PyObject.java:477)
at org.python.core.PyObject.__call__(PyObject.java:481)
at org.python.core.PyMethod.__call__(PyMethod.java:141)
at org.python.pycode._pyx356.f$0(<input>:22)
at org.python.pycode._pyx356.call_function(<input>)
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1687)
at org.python.core.Py.exec(Py.java:1731)
at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:277)
at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:130)
at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:611)
at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:599)
at java.desktop/javax.swing.SwingWorker$1.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.desktop/javax.swing.SwingWorker.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at org.apache.poi.xslf.usermodel.XSLFSimpleShape.getGeometry(XSLFSimpleShape.java:729)
at org.apache.poi.sl.draw.DrawSimpleShape.computeOutlines(DrawSimpleShape.java:381)
at org.apache.poi.sl.draw.DrawSimpleShape.draw(DrawSimpleShape.java:74)
at org.apache.poi.sl.draw.DrawSheet.draw(DrawSheet.java:71)
at org.apache.poi.sl.draw.DrawSheet.draw(DrawSheet.java:50)
at org.apache.poi.sl.draw.DrawSheet.draw(DrawSheet.java:50)
at org.apache.poi.sl.draw.DrawSlide.draw(DrawSlide.java:41)
at org.apache.poi.xslf.usermodel.XSLFSlide.draw(XSLFSlide.java:373)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:190)
... 20 more
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at java.base/java.net.URLClassLoader.findClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 33 more
Traceback (most recent call last):
File "<input>", line 29, in <module>
at org.apache.poi.xslf.usermodel.XSLFSimpleShape.getGeometry(XSLFSimpleShape.java:729)
at org.apache.poi.sl.draw.DrawSimpleShape.computeOutlines(DrawSimpleShape.java:381)
at org.apache.poi.sl.draw.DrawSimpleShape.draw(DrawSimpleShape.java:74)
at org.apache.poi.sl.draw.DrawSheet.draw(DrawSheet.java:71)
at org.apache.poi.sl.draw.DrawSheet.draw(DrawSheet.java:50)
at org.apache.poi.sl.draw.DrawSheet.draw(DrawSheet.java:50)
at org.apache.poi.sl.draw.DrawSlide.draw(DrawSlide.java:41)
at org.apache.poi.xslf.usermodel.XSLFSlide.draw(XSLFSlide.java:373)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException