Open Source JavaScript Library for Microsoft® PPTX Presentations
Generate, Update, Manipulate & Convert PowerPoint PPTX Files on the Server-Side via Leading Open Source JavaScript API.
What is Node-PPTX?
Node-PPTX is an open-source pure JavaScript library that allows software developers to read, write, compose and manipulate PPTX files. The library provided functionality for creating a brand new file from scratch as well as modifying an existing PPTX file. The library offers very user-friendly features and provides the capability to generate presentations with just a couple of JavaScript commands.
The library has provided support for several important features such as creating a presentation from scratch, modifying presentation, setting text direction, adding slides, removing slides, reordering slides, formatting options, applying master slides, adding slide numbers, adding content to slides and many more.
Getting Started with Node-PPTX
You can use the npm package to install the Node-PPTX package.
Install via npm command
$ npm i nodejs-pptx
Generate PPTX Presentation from Scratch via JavaScript API
The open-source library Node-PPTX enables software programmers to generate a new PPTX presentation from scratch using a few lines of code. It also provides support to modify existing presentations with ease. Developers can also add new slides, images, basic charts, shapes, etc. to their presentations. By using the following line of code you can easily generate PPTX from scratch.
Create PPTX
- Import Node-PPTX
- Initialize PPTX.Composer
- Add slide and text
- Save PPTX
How to Create PPTX Presentation in JavaScript?
const PPTX = require('nodejs-pptx');
let pptx = new PPTX.Composer();
// add text in slide
await pptx.compose(pres => {
pres.addSlide(slide => {
slide.addText(text => {
text.value('File Format Developer Guide');
});
});
});
await pptx.save(`./fileformat.pptx`);
Adding Content to Presentation Slides
The Node-PPTX API fully supports charts, images, text boxes, and shapes addition to PowerPoint PPTX presentations. Here are some ways in which you can add these elements to a slide. Objects are layered on top of one another in the order in which they are added. Therefore you'll want to add background items first and gradually work your way toward the top of the composition.
Adding Text Boxes to Presentation
The Node-PPTX library gives software programmers the capability to include text boxes to a PPTX Presentation inside their own JavaScript applications. The creation of external links is supported by the text box element that opens in a web browser. The API also provides support for internal linking which link to another slide in the same presentation. For the creation of an external link please provide the full URI path as the value for the URL key. Moreover, for linking to other slides please provide the slide number proceeded with a hash sign.