Convert PDF to SVG in Node.js
Convert PDF files to SVG with Aspose.Slides for Node.js via Java.
Convert PDF to SVG in Node.js
Aspose.Slides for Node.js via Java
lets you import PDF files into a presentation and export the imported slides as SVG files. With this Node.js API, you can convert PDF content without Adobe Acrobat.
Convert PDF to SVG using Node.js
To convert PDF to SVG, create a Presentation, import the source file with addFromPdf, and export the imported slides with writeAsSvg.
Node.js code to convert PDF to SVG
const presentation = new aspose.slides.Presentation();
try {
presentation.getSlides().removeAt(0);
presentation.getSlides().addFromPdf("sourceFile.pdf");
const slideCount = presentation.getSlides().size();
for (let slideIndex = 0; slideIndex < slideCount; slideIndex++) {
const slide = presentation.getSlides().get_Item(slideIndex);
const filePath = "slide_" + slide.getSlideNumber() + ".svg";
const svgStream = java.newInstanceSync("java.io.FileOutputStream", filePath);
try {
slide.writeAsSvg(svgStream);
}
finally {
svgStream.close();
}
}
}
finally {
presentation.dispose();
}
How to convert PDF to SVG using Aspose.Slides for Node.js via Java API
To convert PDF to SVG using Aspose.Slides for Node.js via Java, import the package, import the source file into a presentation, and export slides as SVG files.
Install Aspose.Slides for Node.js via Java .
Import the
aspose.slides.via.javapackage in your Node.js project.Import the source
PDFfile withaddFromPdf.Call the
writeAsSvgmethod for each imported slide.
Convert PDF to Other Supported Formats
You can also convert PDF files to other supported presentation and export formats.