Node.js PowerPoint API for Presentations
Create, read, modify, and convert PowerPoint and OpenDocument presentations using Node.js without requiring Microsoft PowerPoint.
Download Free TrialAspose.Slides for Node.js via .NET is a Node.js library for creating, modifying, and converting PowerPoint presentations. It supports presentation elements such as slides, shapes, text, charts, tables, images, SmartArt, OLE objects, multimedia, and VBA macros. The API also supports merging, cloning, splitting, comparing, rendering, and printing presentations without Microsoft PowerPoint.
Aspose.Slides for Node.js via .NET provides these popular features:
- Loading, opening, and viewing presentations.
- Editing presentations.
- Converting presentation files to popular presentation formats, such as
PPT,PPTX, andODP. - Exporting presentations to
PDF,JPG,HTML,GIF,SVG, and many other formats. - Rendering and printing presentations.
- Encrypting and decrypting presentations; password-protecting presentations and removing passwords.
- Manipulating presentation entities, such as master slides, shapes, charts, picture frames, audio frames, video frames, OLE, VBA macros, animations, etc.
- Automatically translating presentations using AI-powered translation through external language model integration.
Node.js is a popular, free, open-source, cross-platform JavaScript runtime environment that lets developers write command line tools and server-side scripts outside of a browser. For this reason, the Aspose.Slides team is proud to offer Aspose.Slides for Node.js via .NET to the Node.js community.
Advanced Node.js PowerPoint API Features
How to Create a New PowerPoint Presentation in Node.js
The example below adds a rectangle to the first slide of a presentation.
const presentation = new asposeSlides.Presentation();
try {
const slide = presentation.slides.get(0);
slide.shapes.addAutoShape(asposeSlides.ShapeType.Rectangle, 50, 150, 300, 200);
presentation.save("presentation.pptx", asposeSlides.SaveFormat.Pptx);
}
finally {
presentation.dispose();
}
Create slides or clone existing slides from templates
Work with PowerPoint tables via API
Apply or remove shape protection
Add Excel charts as OLE objects to slides
Create shapes and add text to shapes on slides
Handle text and shape formatting
Generate presentations from a database
Protect presentations and generated PDF files
Print presentations on a physical printer
System Requirements
- Aspose.Slides for Node.js via .NET is a server-side JavaScript API based on Node.js. It can run on Windows, Linux, and macOS with .NET 6 or later.
How to Install
Use npm to install the Aspose.Slides Node.js library for presentation processing from the npm package repository:
npm install aspose.slides.via.net
How to Add and Clone Slides and Edit Shape Properties in Node.js
This Node.js code shows you how to add and clone slides and set a slide background:
const presentation = new asposeSlides.Presentation();
const sourcePresentation = new asposeSlides.Presentation();
try {
// Add an empty slide to the presentation.
const layoutSlide = presentation.layoutSlides.get(0);
presentation.slides.addEmptySlide(layoutSlide);
// Clone a slide from the source presentation.
const sourceSlide = sourcePresentation.slides.get(0);
presentation.slides.addClone(sourceSlide);
// Access and modify properties of the first slide.
const slide = presentation.slides.get(0);
// Set the background of the first slide.
slide.background.type = asposeSlides.BackgroundType.OwnBackground;
slide.background.fillFormat.fillType = asposeSlides.FillType.Solid;
slide.background.fillFormat.solidFillColor.color = "#AEC025F4";
}
finally {
sourcePresentation.dispose();
presentation.dispose();
}
How to Convert PowerPoint to PDF in Node.js
This Node.js code shows you how to convert a PowerPoint presentation to a PDF document.
const presentation = new asposeSlides.Presentation("presentation.pptx");
try {
presentation.save("presentation.pdf", asposeSlides.SaveFormat.Pdf);
}
finally {
presentation.dispose();
}
How to Convert PowerPoint to GIF in Node.js
This Node.js code shows you how to convert a PowerPoint presentation to a GIF image.
const presentation = new asposeSlides.Presentation("presentation.pptx");
try {
presentation.save("presentation.gif", asposeSlides.SaveFormat.Gif);
}
finally {
presentation.dispose();
}
How to Convert PowerPoint to HTML in Node.js
This Node.js code shows you how to convert a PowerPoint presentation to an HTML document.
const presentation = new asposeSlides.Presentation("presentation.pptx");
try {
presentation.save("presentation.html", asposeSlides.SaveFormat.Html);
}
finally {
presentation.dispose();
}
How to Convert PowerPoint to ODP in Node.js
This Node.js code shows you how to convert a PowerPoint presentation to an ODP document.
const presentation = new asposeSlides.Presentation("presentation.pptx");
try {
presentation.save("presentation.odp", asposeSlides.SaveFormat.Odp);
}
finally {
presentation.dispose();
}
How to Merge Presentations in Node.js
This Node.js code shows you how to merge presentations:
const destinationPresentation = new asposeSlides.Presentation("presentation1.pptx");
const sourcePresentation = new asposeSlides.Presentation("presentation2.pptx");
try {
const slideCount = sourcePresentation.slides.length;
for (let slideIndex = 0; slideIndex < slideCount; slideIndex++) {
const slide = sourcePresentation.slides.get(slideIndex);
destinationPresentation.slides.addClone(slide);
}
destinationPresentation.save("combined-presentation.pptx", asposeSlides.SaveFormat.Pptx);
}
finally {
destinationPresentation.dispose();
sourcePresentation.dispose();
}
How to Retrieve Various Properties of a PowerPoint Presentation
The following example shows you how to retrieve various properties of a PowerPoint presentation.
const presentation = new asposeSlides.Presentation("presentation.pptx");
try {
// Retrieve various properties of the presentation.
const slideCount = presentation.slides.length;
const masterSlideCount = presentation.masters.length;
const layoutSlideCount = presentation.layoutSlides.length;
const firstSlideNumber = presentation.firstSlideNumber;
const lastView = presentation.viewProperties.lastView;
const masterThemeName = presentation.masterTheme.name;
const sourceFormat = presentation.sourceFormat;
const videoCount = presentation.videos.length;
const imageCount = presentation.images.length;
// Log presentation properties to the console.
console.log("Slide count: " + slideCount);
console.log("Master slide count: " + masterSlideCount);
console.log("Layout slide count: " + layoutSlideCount);
console.log("First slide number: " + firstSlideNumber);
console.log("Last view: " + lastView);
console.log("Master theme name: " + masterThemeName);
console.log("Source format: " + sourceFormat);
console.log("Video count: " + videoCount);
console.log("Image count: " + imageCount);
}
finally {
presentation.dispose();
}
FAQ
- What do I install, and does the machine need .NET?
npm install aspose.slides.via.net, and yes — it runs on Windows, Linux and macOS with .NET 6 or later present. - How does it differ from Aspose.Slides for Node.js via Java?This build bridges to .NET and needs a .NET 6+ runtime; the via Java build bridges to a JVM and needs JDK 1.8 or above. The presentation features are the same, so pick the runtime you already operate.
- Can it run inside a Node.js container image?Yes, provided the image also carries the .NET 6+ runtime. A plain
node:alpinebase does not, so either start from an image that includes .NET or install it in the Dockerfile. - Is presentation processing blocking?The calls are synchronous, so converting a large deck on the main thread will stall the event loop. Move heavy conversions to a worker thread or a separate process.
Support and Learning Resources
- Learning Resources
- Documentation
- API References
- Product Support
- Free Support
- Paid Support
- Blog
- Release Notes
- Why Aspose.Slides for Node.js via .NET?
- Customers List
- Success Stories