Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active March 30, 2025 04:24
Show Gist options
  • Save aspose-com-gists/e04458d2b20ddce3f899d2324e95e1b4 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/e04458d2b20ddce3f899d2324e95e1b4 to your computer and use it in GitHub Desktop.
Document Conversion using Node.js
var pres = new aspose.slides.Presentation("Convert_HTML.pptx");
try {
var controller = new aspose.slides.ResponsiveHtmlController();
var htmlOptions = new aspose.slides.HtmlOptions();
htmlOptions.setHtmlFormatter(aspose.slides.HtmlFormatter.createCustomFormatter(controller));
pres.save("ConvertPresentationToResponsiveHTML_out.html", aspose.slides.SaveFormat.Html, htmlOptions);
} finally {
if (pres != null) {
pres.dispose();
}
}
var pres = new aspose.slides.Presentation("PowerPoint-Presentation.pptx");
try {
for (let i = 0; i < pres.getSlides().size(); i++) {
let sld = pres.getSlides().get_Item(i);
// Creates a full scale image
var slideImage = sld.getImage(1.0, 1.0);
// Saves the image to disk in JPEG format
try {
slideImage.save(java.callStaticMethodSync("java.lang.String", "format", "Slide_%d.jpg", sld.getSlideNumber()), aspose.slides.ImageFormat.Jpeg);
} finally {
if (slideImage != null) {
slideImage.dispose();
}
}
}
} finally {
if (pres != null) {
pres.dispose();
}
}
let presentation = new aspose.slides.Presentation("PowerPoint.ppt");
try {
presentation.save("PPT-to-PDF.pdf", aspose.slides.SaveFormat.Pdf);
} finally {
presentation.dispose();
}
var pres = new aspose.slides.Presentation("pres.pptx");
try {
for (var index = 0; index < pres.getSlides().size(); index++) {
var slide = pres.getSlides().get_Item(index);
var fileStream = java.newInstanceSync("java.io.FileOutputStream", ("slide-" + index) + ".svg");
try {
slide.writeAsSvg(fileStream);
} finally {
fileStream.close();
}
}
} catch (e) {console.log(e);
} finally {
if (pres != null) {
pres.dispose();
}
}
var pres = new aspose.slides.Presentation("Aspose.ppt");
try {
pres.save("ConvertedAspose.pptx", aspose.slides.SaveFormat.Pptx);
} finally {
if (pres != null) {
pres.dispose();
}
}
var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
var diagram = new aspose.diagram.Diagram("sample.vsdx");
diagram.save("visio-to-html.html", aspose.diagram.SaveFileFormat.HTML);
var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
var diagram = new aspose.diagram.Diagram("sample.vsdx");
options = new aspose.diagram.ImageSaveOptions(aspose.diagram.SaveFileFormat.JPG);
options.setPageIndex(0);
diagram.save("Visio-to-image.jpg", options);
var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
var diagram = new aspose.diagram.Diagram("sample.vsdx");
options = new aspose.diagram.ImageSaveOptions(aspose.diagram.SaveFileFormat.PNG);
options.setPageIndex(0);
diagram.save("Visio to PNG.png", options);
var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
var diagram = new aspose.diagram.Diagram("sample.vsdx");
diagram.save("visio-to-pdf.pdf", aspose.diagram.SaveFileFormat.PDF);
var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
var diagram = new aspose.diagram.Diagram("sample.vsdx");
options = new aspose.diagram.ImageSaveOptions(aspose.diagram.SaveFileFormat.PNG);
options.setPageIndex(0);
diagram.save("visio-to-png.png", options);
var aspose = aspose || {};
aspose.diagram = require("aspose.diagram")
var diagram = new aspose.diagram.Diagram("sample.vsdx");
diagram.save("Visio-to-SVG.svg", aspose.diagram.SaveFileFormat.SVG);
var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
var diagram = new aspose.diagram.Diagram("sample.vsdx");
diagram.save("Visio-to-XAML.xaml", aspose.diagram.SaveFileFormat.XAML);
var aspose = aspose || {};
aspose.threed = require("aspose.threed");
var scene = new aspose.threed.Scene();
scene.getRootNode().createChildNode(new aspose.threed.Cylinder());
var opt =new aspose.threed.Html5SaveOptions();
opt.setShowGrid(false);
opt.setShowUI(false);
scene.save("html5SaveOption.html);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment