Aspose.Slides  for Node.js via .NET

Node.js PowerPoint API for Presentations

Create, read, modify, and convert PowerPoint and OpenOffice presentations using Node.js without external software.

  Download Free Trial

Aspose.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, and ODP.
  • 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

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 PDFs

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 Create a New PowerPoint Presentation in Node.js

In the example given below, we have added a rectangle to the first slide of the presentation.

            
const asposeSlides = require('aspose.slides.via.net');

const { Presentation, SaveFormat, ShapeType } = asposeSlides;

let presentation = new Presentation();
try {
    const slide = presentation.slides.get(0);
    slide.shapes.addAutoShape(ShapeType.Rectangle, 50, 150, 300, 200);

    presentation.save("presentation.pptx", SaveFormat.Pptx);
}
finally {
    presentation.dispose();
}
            
        

How to Add/Remove/Clone Slides and Edit Shape Properties in Node.js

This Node.js code shows you how to edit various properties and clone slides:

            
const asposeSlides = require('aspose.slides.via.net');

const { Presentation, BackgroundType, FillType } = asposeSlides;

let presentation = new Presentation();
let sourcePresentation = null;
try {
    // Add an empty slide to the presentation.
    let layoutSlide = presentation.layoutSlides.get(0);
    presentation.slides.addEmptySlide(layoutSlide);

    // Create another presentation and add its clone to the main presentation.
    sourcePresentation = new Presentation();
    presentation.slides.addClone(sourcePresentation.slides.get(0));

    // Access and modify properties of the first slide.
    const slide = presentation.slides.get(0);

    // Set the background of the first slide.
    slide.background.type = BackgroundType.OwnBackground;
    slide.background.fillFormat.fillType = FillType.Solid;
    slide.background.fillFormat.solidFillColor.color = "#AEC025F4";
}
finally {
    if(sourcePresentation != null) 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 asposeSlides = require('aspose.slides.via.net');

const { Presentation, SaveFormat } = asposeSlides;

let presentation = new Presentation("presentation.pptx");
try {
    presentation.save("presentation.pdf", 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 asposeSlides = require('aspose.slides.via.net');

const { Presentation, SaveFormat } = asposeSlides;

let presentation = new Presentation("presentation.pptx");
try {
    presentation.save("presentation.gif", 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 asposeSlides = require('aspose.slides.via.net');

const { Presentation, SaveFormat } = asposeSlides;

let presentation = new Presentation("presentation.pptx");
try {
    presentation.save("presentation.html", 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 asposeSlides = require('aspose.slides.via.net');

const { Presentation, SaveFormat } = asposeSlides;

let presentation = new Presentation("presentation.pptx");
try {
    presentation.save("presentation.odp", SaveFormat.Odp);
}
finally {
    presentation.dispose();
}
            
        

How to Merge Presentations in Node.js

This Node.js code shows you how to merge presentations:

            
const asposeSlides = require('aspose.slides.via.net');

const { Presentation, SaveFormat } = asposeSlides;

let dstPresentation = new Presentation("presentation1.pptx");
let srcPresentation = new Presentation("presentation2.pptx");
try {
    for (let slideIndex = 0; slideIndex < srcPresentation.slides.count; slideIndex++) {
        let slide = srcPresentation.slides.get(slideIndex);
        dstPresentation.slides.addClone(slide);
    }

    dstPresentation.save("combined_presentation.pptx", SaveFormat.Pptx);
}
finally {
    dstPresentation.dispose();
    srcPresentation.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 asposeSlides = require('aspose.slides.via.net');

const { Presentation } = asposeSlides;

let presentation = new Presentation("presentation.pptx");
try {
    // Retrieve various properties of the presentation.
    const countSlides = presentation.slides.count;
    const countMastersSlides = presentation.masters.count;
    const countLayoutSlides = presentation.layoutSlides.count;
    const firstSlideNumber = presentation.firstSlideNumber;
    const lastView = presentation.viewProperties.lastView;
    const masterThemeName = presentation.masterTheme.name;
    const sourceFormat = presentation.sourceFormat;
    const countVideos = presentation.videos.count;
    const countImages = presentation.images.count;

    // Log presentation properties to the console.
    console.log("countSlides:" + countSlides);
    console.log("countMastersSlides:" + countMastersSlides);
    console.log("countLayoutSlides:" + countLayoutSlides);
    console.log("firstSlideNumber:" + firstSlideNumber);
    console.log("lastView=" + lastView);
    console.log("masterThemeName:" + masterThemeName);
    console.log("sourceFormat:" + sourceFormat);
    console.log("countVideos:" + countVideos);
    console.log("countImages:" + countImages);
}
finally {
    presentation.dispose();
}
            
        
  

Support and Learning Resources