A powerful library for manipulating and converting PowerPoint (PPT, PPTX, PPS, POT, PPSX, PPTM, PPSM, POTX, POTM), ODP, ODS, CSV, TXT, PNG, EMF, JPG, JSON and HTML files.
npm install aspose.slides.via.netnpm
npm install aspose.slides.via.net
`
Please use the following article for details.
$3
`javascript
// Import the Aspose.Slides module for PowerPoint file manipulation
const asposeSlides = require('aspose.slides.via.net');
// Add necessary classes from the asposeSlides
const { Presentation, SaveFormat, PdfOptions } = asposeSlides;
const fs = require('fs');
if (!fs.existsSync("out")) fs.mkdirSync("out");
// Create and save an empty presentation to demonstrate basic functionality
function createEmptyPresentation() {
// Initialize a new empty presentation
var emptyPresentation = new Presentation();
// Save the empty presentation in PPTX format
emptyPresentation.save("out/emptyPresentation.pptx", SaveFormat.Pptx);
// Release resources associated with the presentation
emptyPresentation.dispose();
}
createEmptyPresentation(); // Execute the function to create an empty presentation
`
$3
`javascript
// Import the Aspose.Slides module for PowerPoint file manipulation
const asposeSlides = require('aspose.slides.via.net');
const {
Presentation,
BackgroundType,
FillType,
ImageFormat
} = asposeSlides;
const fs = require('fs');
// Function to demonstrate creating and manipulating a presentation
function manipulatePresentation() {
// Create a new presentation instance
var pres = new Presentation();
// Add an empty slide to the presentation
pres.slides.addEmptySlide(pres.layoutSlides.get(0));
// Create another presentation instance for cloning purposes
var pres2 = new Presentation();
// Add a clone of the first slide from pres2 into pres
pres.slides.addClone(pres2.slides.get(0));
// Log the current count of slides in pres
console.log("countSlides:" + pres.slides.count);
// Remove the first slide from pres
pres.slides.removeAt(0);
// Log the new count of slides after removal
console.log("countSlides:" + pres.slides.count);
// 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
// Log background type and color of the first slide
console.log("backgroundType:" + slide.background.type);
console.log("backgroundColor:" + slide.background.fillFormat.solidFillColor.color);
if (!fs.existsSync("out")) fs.mkdirSync("out");
// Generate and save a thumbnail of the first slide
var slideThumbnail = slide.getThumbnailWithImageSize({width: 960, height: 720}); // Get slide thumbnail
slideThumbnail.save("out/slide-thumbnail.png", ImageFormat.Png); // Save thumbnail as PNG
// Save the presentation to a file
pres.save("out/slides-manipulation.pptx", asposeSlides.SaveFormat.Pptx);
// Dispose of presentation objects to free resources
pres.dispose();
pres2.dispose();
}
``