public static void main(String[] args) {
        File file = new File("/Users/**/Downloads/ Oyster cannon southwest barbecue. PPTX");
        // Scale up
        double scale = 1.5;
        try(SlideShow<? ,? > ss = SlideShowFactory.create(file,null.true)) {
            Dimension pgsize = ss.getPageSize();
            int width = (int) (pgsize.width * scale);
            int height = (int) (pgsize.height * scale);
            for(Slide<? ,? > slide : ss.getSlides()) { BufferedImage img =new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
                Graphics2D graphics = img.createGraphics();
                // default rendering options
                graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
                graphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
                graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
                graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
                graphics.setRenderingHint(Drawable.BUFFERED_IMAGE, new WeakReference<>(img));
                // Scale up
                graphics.scale(scale, scale);
                // draw stuff
                slide.draw(graphics);
                try {
                    ImageIO.write(img, "PNG".new File("/Users/**/Downloads/ppt/"+System.currentTimeMillis()+"output.png"));
                } catch(IOException e) { e.printStackTrace(); } graphics.dispose(); img.flush(); }}catch(IOException e) { e.printStackTrace(); }}Copy the code

pom


        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>4.1.2</version>
        </dependency>
        
        <dependency>
            <groupId>org.apache.xmlgraphics</groupId>
            <artifactId>batik-codec</artifactId>
            <version>1.13</version>
        </dependency>
Copy the code