Convert PDF to PNG in Node.js

Aspose.Slides for Node.js via Java is a powerful and easy-to-use library that allows you to convert PowerPoint presentations to various formats in Node.js. It supports all presentation elements and formats and provides a rich API to access and modify them. It also allows you to export your slides to various formats for further processing or sharing.

Convert PDF to PNG in Node.js

Aspose.Slides for Node.js via Java is a powerful Node.js library for creating and manipulating presentation files. Moreover, it provides flexible ways to convert PDF to PNG. Using Aspose.Slides for Node.js via Java, any developer or application can convert PDF to PNG files with just a few lines of code.

As a modern document processing API, Aspose.Slides for Node.js exports PDF files to PNG file formats quickly. Aspose PowerPoint library allows you to convert PDF to PNGs and many other file formats

Convert PDF to PNG using Node.js

To convert the PDF to PNG, you will need to create Presentation from PDF file and save it as PNG.

Node.js code for convert PDF into PNG


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");

    for(var i = 0; i < pres.getSlides().size(); i++)
    {
        var sld = pres.getSlides().get_Item(i);
        var bi = sld.getThumbnail(2, 2);
        var outputfile = java.newInstanceSync("java.io.File", "slide_" + sld.getSlideNumber() + ".png");
        java.callStaticMethod("javax.imageio.ImageIO", "write", bi, "png", outputfile);
    }
}
finally
{
    if (pres != null) pres.dispose();
} 

How to convert PDF to PNG using using Aspose.Slides for Node.js via Java API

To convert PDF to PNG using Aspose.Slides for Node.js via Java, you need to import the package in your JavaScript file and create an instance of the Presentation class. The Presentation class represents a PowerPoint document and provides methods to access and manipulate its elements.

  1. Install Aspose.Slides for Node.js via Java .

  2. Add a library reference (import the library) to your Node.js project.

  3. Open the source PDF files in Node.js.

  4. Save result as PNG file.

Convert PDF To Other Supported Formats

You can also convert PDF and save to other file formats. See all supported formats below