Convert POTM to PNG in Node.js

Convert PowerPoint Macro-Enabled Template files to PNG with Aspose.Slides for Node.js via Java.

Convert POTM to PNG in Node.js

Aspose.Slides for Node.js via Java lets developers create, read, edit, and convert presentation files in Node.js applications. You can load a POTM file with the Presentation class and export its slides to PNG images by using the presentation API.

Convert POTM to PNG using Node.js

To convert POTM to PNG, create a Presentation from the source file and export each slide to a PNG image.

Node.js code to convert POTM to PNG

const presentation = new aspose.slides.Presentation("sourceFile.potm");
try {
    const slideCount = presentation.getSlides().size();
    for (let slideIndex = 0; slideIndex < slideCount; slideIndex++) {
        const slide = presentation.getSlides().get_Item(slideIndex);
        const slideImage = slide.getImage(2, 2);
        try {
            const filePath = "slide_" + slide.getSlideNumber() + ".png";
            slideImage.save(filePath, aspose.slides.ImageFormat.Png);
        }
        finally {
            slideImage.dispose();
        }
    }
}
finally {
    presentation.dispose();
}

How to convert POTM to PNG using Aspose.Slides for Node.js via Java API

To convert POTM to PNG using Aspose.Slides for Node.js via Java, import the package, load the source file with the Presentation class, and export slides as images.

  1. Install Aspose.Slides for Node.js via Java .

  2. Import the aspose.slides.via.java package in your Node.js project.

  3. Load the source POTM file with the Presentation class.

  4. Render each slide with getImage and save it with ImageFormat.Png.