Convert PDF to BMP in Node.js

Convert PDF files to BMP with Aspose.Slides for Node.js via Java.

Convert PDF to BMP in Node.js

Aspose.Slides for Node.js via Java lets you import PDF files into a presentation and render the imported slides as BMP images. With this Node.js API, you can convert PDF content without Adobe Acrobat.

Convert PDF to BMP using Node.js

To convert PDF to BMP, create a Presentation, import the source file with addFromPdf, and render the imported slides as images.

Node.js code to convert PDF to BMP

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 slideImage = slide.getImage(2, 2);
        try {
            const filePath = "slide_" + slide.getSlideNumber() + ".bmp";
            slideImage.save(filePath, aspose.slides.ImageFormat.Bmp);
        }
        finally {
            slideImage.dispose();
        }
    }
}
finally {
    presentation.dispose();
}

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

To convert PDF to BMP using Aspose.Slides for Node.js via Java, import the package, import the source file into a presentation, and export slides as images.

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

  2. Import the aspose.slides.via.java package in your Node.js project.

  3. Import the source PDF file with addFromPdf.

  4. Render each slide with getImage and save it with ImageFormat.Bmp.