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 any external software.

  Download Free Trial

Aspose.Slides for Node.js via .NET is a Node.js library that lets you create, modify, and convert PowerPoint presentations in Node.js. It supports all presentation elements such as slides, shapes, text, charts, tables, images, and more. It also offers many advanced features such as merging, cloning, splitting, comparing, and printing presentations. It works without any dependencies and can process thousands of presentations in a short time.

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.
  • And many more features.

Node.js is a popular, free, open-source and cross-platform JavaScript runtime environmentthat 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 or clone existing slides from templates

Work with PowerPoint tables via API

Apply or remove the protection on shapes

Add Excel charts as OleObjects to slides

Create shapes and add text to shapes on slides

Handle text & shape formatting

Generate presentations from database

Protect presentations & resultant PDF

Print presentations on a physical printer

System Requirements

  • Aspose.Slides for Node.js via .NET is server-side JavaScript API based on Node.js. It can run on Windows, Unix/Linux & Mac platforms with .NET6 or above.

How to Install

Use NPM to install our Node.js library for Presentation processing from the NPM Package repository:

npm install aspose.slides.via.net

How to Create 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;

var pres = new Presentation();
try 
{
    var slide = pres.slides.get(0);
    slide.shapes.addAutoShape(ShapeType.Rectangle, 50, 150, 300, 200);
    
    pres.save("pres.pptx", SaveFormat.Pptx);
}
finally
{
    if (pres != null) pres.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, ImageFormat } = asposeSlides;

var pres = new Presentation();
try 
{
    // Add an empty slide to the presentation
    pres.slides.addEmptySlide(pres.layoutSlides.get(0));
    
    // Create another presentation and add its clone into the pres
    var pres2 = new Presentation();
    pres.slides.addClone(pres2.slides.get(0));
    
    // Access and modify properties of the first slide in pres
    var slide = pres.slides.get(0); // Get the first slide
    var slideNumber = slide.slideNumber; // Get slide number
    var hidden = slide.hidden; // Check if the slide is hidden
	
    // Set the background of the first slide
    slide.background.type = BackgroundType.OwnBackground; // Set background type
    slide.background.fillFormat.fillType = FillType.Solid; // Set fill type to solid
    slide.background.fillFormat.solidFillColor.color = "#AEC025F4"; // Set a solid fill color
}
finally
{
    if (pres != null) pres.dispose();
}
            
        

How to Convert PowerPoint to PDF in Node.js

This Node.js code shows you how to convert a PowerPoint to a PDF document

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

const { Presentation, SaveFormat } = asposeSlides;

var pres = new Presentation("pres.pptx");
try 
{
    pres.save("pres.pdf", SaveFormat.Pdf);
}
finally
{
    if (pres != null) pres.dispose();
}
            
        

How to Convert PowerPoint to GIF in Node.js

This Node.js code shows you how to convert a PowerPoint to a GIF image

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

const { Presentation, SaveFormat } = asposeSlides;

var pres = new Presentation("pres.pptx");
try 
{
    pres.save("pres.gif", SaveFormat.Gif);
}
finally
{
    if (pres != null) pres.dispose();
}
            
        

How to Convert PowerPoint to HTML in Node.js

This Node.js code shows you how to convert a PowerPoint to a HTML document

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

const { Presentation, SaveFormat } = asposeSlides;

var pres = new Presentation("pres.pptx");
try 
{
    pres.save("pres.html", SaveFormat.Html);
}
finally
{
    if (pres != null) pres.dispose();
}
            
        

How to Convert PowerPoint to ODP in Node.js

This Node.js code shows you how to convert a PowerPoint to a ODP document

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

const { Presentation, SaveFormat } = asposeSlides;

var pres = new Presentation("pres.pptx");
try 
{
    pres.save("pres.odp", SaveFormat.Odp);
}
finally
{
    if (pres != null) pres.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;

var pres1 = new Presentation("pres1.pptx");
var pres2 = new Presentation("pres2.pptx");
try 
{
    for (var i = 0; i < pres2.slides.length; i++) 
    {
        pres1.slides.addClone(pres2.slides.get(i));
    }
    
    pres1.save("combinedPresentation.pptx", SaveFormat.Pptx);
}
finally
{
    if (pres1 != null) pres1.dispose();
    if (pres2 != null) pres2.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;

var pres = new Presentation("pres.pptx");
try 
{
    // Retrieve various properties of the presentation
    var countSlides = pres.slides.count; // Total number of slides
    var countMastersSlides = pres.masters.count; // Total number of master slides
    var countLayoutSlides = pres.layoutSlides.count; // Total number of layout slides
    var firstSlideNumber = pres.firstSlideNumber; // Number of the first slide
    var lastView = pres.viewProperties.lastView; // Last view type of the presentation
    var masterThemeName = pres.masterTheme.name; // Name of the master theme
    var sourceFormat = pres.sourceFormat; // Format of the source presentation
    var countVideos = pres.videos.count; // Total number of videos in the presentation
    var countImages = pres.images.count; // Total number of images in the presentation
    
    // Retrieve objects for further manipulation or information extraction
    var slideObject = pres.slides.get(0); // Object of the first slide
    var mastersSlideObject = pres.masters.get(0); // Object of the first master slide
    
    // Log the total number of slides 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
{
    if (pres != null) pres.dispose();
}
            
        
  

Support and Learning Resources