We are pleased to announce the launch of Aspose.Slides for Node.js via Java. This product is targeted at developers who want to use Aspose.Slides for Java to create and manipulate Microsoft PowerPoint and OpenOffice presentations in their node.js applications and Javascript server-side platforms.
Aspose.Slides for Node.js via Java is a class library that enables your applications to read and write PowerPoint® documents without using Microsoft PowerPoint®. This new product provides full Aspose.Slides features with a few limitations, additional installation/usage requirements, and API changes.
Installing Aspose.Slides for Node.js
Aspose.Slides for Node.js via Java is a platform-independent API and can be used on any platform (Windows, Linux, and MacOS) where theNode.js
and node-java
bridges are installed.
To install, Aspose.Slides for Node.js via Java, see the product Installation page.
Using Aspose.Slides for Node.js via Java
Create PowerPoint in Node.js
var aspose = aspose || {};
aspose.slides = require("aspose.slides.via.java");
var pres = new aspose.slides.Presentation();
try
{
// Gets the first slide
var slide = pres.getSlides().get_Item(0);
// Adds an autoshape with type set to rectangle
slide.getShapes().addAutoShape(aspose.slides.ShapeType.Rectangle, 50, 150, 300, 200);
pres.save("outputPresentation.pptx", aspose.slides.SaveFormat.Pptx);
}
finally
{
if (pres != null) pres.dispose();
}
Merge PowerPoint in Node.js
var aspose = aspose || {};
aspose.slides = require("aspose.slides.via.java");
var pres1 = new aspose.slides.Presentation("pres1.pptx");
var pres2 = new aspose.slides.Presentation("pres2.pptx");
try
{
for (var i = 0; i < pres2.getSlides().size(); i++)
{
pres1.getSlides().addClone(pres2.getSlides().get_Item(i));
}
pres1.save("combinedPresentation.pptx", aspose.slides.SaveFormat.Pptx);
}
finally
{
if (pres1 != null) pres1.dispose();
if (pres2 != null) pres2.dispose();
}
Convert PowerPoint to PDF in Node.js
var aspose = aspose || {};
aspose.slides = require("aspose.slides.via.java");
// Instantiate a Presentation object that represents a PPT file
var pres = new aspose.slides.Presentation("PowerPoint.ppt");
try
{
// Save the presentation as PDF
pres.save("PPT-to-PDF.pdf", aspose.slides.SaveFormat.Pdf);
}
finally
{
if (pres != null) pres.dispose();
}
Convert PowerPoint to JPG in Node.js
var aspose = aspose || {};
var java = require("java");
aspose.slides = require("aspose.slides.via.java");
// Instantiate a Presentation object that represents a PPT file
var pres = new aspose.slides.Presentation("pres.pptx");
try
{
for (var i = 0; i < pres.getSlides().size(); i++)
{
var bmp = pres.getSlides().get_Item(i).getThumbnail(1, 1);
var imageio = java.newInstanceSync("javax.imageio.ImageIO");
var file = java.newInstanceSync("java.io.File", "slide_" + i + ".jpg");
imageio.write(bmp, "JPEG", file);
}
}
finally
{
if (pres != null) pres.dispose();
}
Import PowerPoint from PDF in Node.js
var aspose = aspose || {};
aspose.slides = require("aspose.slides.via.java");
var pres = new aspose.slides.Presentation();
try
{
pres.getSlides().removeAt(0);
pres.getSlides().addFromPdf("welcome-to-powerpoint.pdf");
pres.save("outputPresentation.pptx", aspose.slides.SaveFormat.Pptx);
}
finally
{
if (pres != null) pres.dispose();
}
For more articles on performing tasks in node.js using Aspose.Slides, see the Developer Guide section of Aspose.Slides for Java documentation. Aspose.Slides for Node.js via Java is based on Aspose.Slides for Java, so most of the latter’s documentation articles can be used for the former.
Resources
These are links to Aspose.Slides for Node.js via Java resources you may need: