Installation
Contents
[
Hide
]
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
- Install JDK8 and configure
JAVA_HOME
environment variable. - Install Node.js (https://nodejs.org/en/download/) and add node.exe to
PATH
. - Install node-gyp.
- Install Windows Build Tools.
- 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
- Download Aspose.Slides for Node.js via Java and extract it to
aspose.slides.nodejs/node_modules/aspose.slides.via.java
. - Create a file named
hello.js
inaspose.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");
- Now run
node hello.js
@command prompt to run it.
Linux
- Install Node.js (https://nodejs.org/en/download/).
- Install JDK8 for Linux and configure
JAVA_HOME
environment variable. - Install python 2.x
- Install
java
bridge. You can run these commands in terminal:
$ mkdir aspose.slides.nodejs
$ cd aspose.slides.nodejs
$ npm install java
- Download Aspose.Slides for Node.js via Java and extract it to
aspose.slides.nodejs/node_modules/aspose.slides.via.java
. - Create a test file named
hello.js
using this sample code inaspose.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");
- Now run
node hello.js
@command prompt to run it.
Mac
- Install Node.js (https://nodejs.org/en/download/).
- Install JDK8 for Mac and configure
JAVA_HOME
environment variable. - 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>
- Install python 2.x (if it is not installed).
- Install Xcode Command Line Tools.
- Install
java
bridge. You can run below commands in terminal:
$ mkdir aspose.slides.nodejs
$ cd aspose.slides.nodejs
$ npm install java
- Download Aspose.Slides for Node.js via Java and extract it into
aspose.slides.nodejs/node_modules/aspose.slides.via.java
. - Create a test file named
hello.js
using this sample code inaspose.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");
- Now run
node hello.js
@command prompt to run it.
Please use the following article if you encounter compilation errors during installation of Aspose.Slides for Node.js via Java.