Installation

Aspose.Slides for Node.js via Java is platform-independent API and can be used on any platform (Windows, Linux and MacOS) where Node.js and java bridge are installed.

Install from NPM

You can easily install Aspose.Slides for Node.js via Java from NPM.

Create a new folder and initiate a new project using the following command:

$ npm init

Fill in the title and version fields (leave the remaining fields with default values)

Install Aspose.Slides for Node.js via Java using the following command:

$ npm install aspose.slides.via.java

If you encounter any problem during the installation process, please refer to this article.

Install from ZIP archive

To install and use Aspose.Slides for Node.js via Java from a ZIP archive, follow these instructions instead:

Windows

  1. Install JDK8 and configure JAVA_HOME environment variable.
  2. Install Node.js (https://nodejs.org/en/download/) and add node.exe to PATH.
  3. Install node-gyp.
  4. Install Windows Build Tools.
  5. Install java bridge and run these commands in Command Prompt as an administrator:
$ mkdir aspose.slides.nodejs

$ cd aspose.slides.nodejs

$ npm install -g node-gyp

$ npm install --global --production windows-build-tools

$ npm install java
  1. Download Aspose.Slides for Node.js via Java and extract it to aspose.slides.nodejs/node_modules/aspose.slides.via.java.
  2. Create a file named hello.js in aspose.slides.nodejs folder using the following sample code:
var aspose = aspose || {};

aspose.slides = require("aspose.slides.via.java");

var pres = new aspose.slides.Presentation();

var slide = pres.getSlides().addEmptySlide(pres.getLayoutSlides().get_Item(0));

slide.getShapes().get_Item(0).getTextFrame().setText("Slide Title Heading");

pres.save("out.pptx", aspose.slides.SaveFormat.Pptx)

console.log("Done");
  1. Now run node hello.js @command prompt to run it.

Linux

  1. Install Node.js (https://nodejs.org/en/download/).
  2. Install JDK8 for Linux and configure JAVA_HOME environment variable.
  3. Install python 2.x
  4. Install java bridge. You can run these commands in terminal:
$ mkdir aspose.slides.nodejs

$ cd aspose.slides.nodejs

$ npm install java
  1. Download Aspose.Slides for Node.js via Java and extract it to aspose.slides.nodejs/node_modules/aspose.slides.via.java.
  2. Create a test file named hello.js using this sample code in aspose.slides.nodejs folder:
var aspose = aspose || {};

aspose.slides = require("aspose.slides.via.java");

var pres = new aspose.slides.Presentation();

var slide = pres.getSlides().addEmptySlide(pres.getLayoutSlides().get_Item(0));

slide.getShapes().get_Item(0).getTextFrame().setText("Slide Title Heading");

pres.save("out.pptx", aspose.slides.SaveFormat.Pptx)

console.log("Done");
  1. Now run node hello.js @command prompt to run it.

Mac

  1. Install Node.js (https://nodejs.org/en/download/).
  2. Install JDK8 for Mac and configure JAVA_HOME environment variable.
  3. Modify JVMCapabilities section in /Library/Java/JavaVirtualMachines/jdk1.8.x_xxx.jdk/Contents/Info.plist with root privilege. jdk1.8.x_xxx.jdk depends on your jdk version. Make it look like this:
<key>JavaVM</key>
    <dict>
        <key>JVMCapabilities</key>
        <array>
                <string>JNI</string>
                <string>BundledApp</string>
                <string>CommandLine</string>
        </array>
  1. Install python 2.x (if it is not installed).
  2. Install Xcode Command Line Tools.
  3. Install java bridge. You can run below commands in terminal:
$ mkdir aspose.slides.nodejs
 
$ cd aspose.slides.nodejs
 
$ npm install java
  1. Download Aspose.Slides for Node.js via Java and extract it into aspose.slides.nodejs/node_modules/aspose.slides.via.java.
  2. Create a test file named hello.js using this sample code in aspose.slides.nodejs folder:
var aspose = aspose || {};

aspose.slides = require("aspose.slides.via.java");

var pres = new aspose.slides.Presentation();

var slide = pres.getSlides().addEmptySlide(pres.getLayoutSlides().get_Item(0));

slide.getShapes().get_Item(0).getTextFrame().setText("Slide Title Heading");

pres.save("out.pptx", aspose.slides.SaveFormat.Pptx)

console.log("Done");
  1. Now run node hello.js @command prompt to run it.