How to Convert PPT or PDF Files to PNG Images Using Node.js

Problem Statement:- How to convert PPT or PDF files to PNG Images using Node.js If you're not familiar with what

Problem Statement:-

How to convert PPT or PDF files to PNG Images using Node.js

If you’re not familiar with what PPT or PDF is, let me give you a quick glance.

PPT is Microsoft PowerPoint’s presentation file format. Text, data, charts, graphs, music, and other multimedia files can all be saved with this file extension. Whereas, PDF (Portable Document Format) is a universally compatible file format based on PostScript. However, PDFs are hard to edit, and sometimes it is a challenge to even extract information.

PNG file is a Portable Network Graphics file that supports transparency and stores images using less data compression. It is notable for being high quality, widely supported.

Description of the Issue:-

I was working on a project for one of our clients. As a part of the new feature addition, our client wishes to have specific functionality, which is converting a pdf or ppt/pptx file to separate images. Implementing this feature in the application was a bit challenging.

The Solution Offered:-

After conducting intense research, I found a way to integrate this feature into the App. In the Ubuntu platform, unoconv, spawn and libreoffice are supported with Node JS. Utilizing this platform enables us to convert ppt or pdf files to png images efficiently.

  • unoconv is a command-line program primarily used to convert between different office document file formats.
  • Spawn is a postfix external command spawner.
  • LibreOffice is an office productivity software suite that is a great alternative to the Microsoft Office Suite of tools.

These are the step by step guide,

  1. Step:1 Install node js
    1. sudo apt install Nodejs
  2. Step:2 Install npm
    1. sudo apt install npm 
  3. Step:3 Install unoconv (universal convertor)
    1. sudo apt-get install unoconv
  4. Step:4 Install libreoffice
    1. sudo apt-get install libreoffice
  5. Step:5 Install pdftoppm
    1. sudo apt-get install poppler-utils
  6. Step:6 Allow your root paths
    1. sudo npm install -g –unsafe-perm=true –allow-root
  7. Step 7: Install
    1. sudo apt-get install poppler-utils
  8. Step:8 Install child-process and import
    1. npm i child_process
  9. Step:9 Convert ppt to pdf command 
    1. unoconv –export Quality=100 samplepptx.pptx samplepptx.pdf
    2. Note : Make sure pdf name is same as ppt name
  10. Step:10 Convert pdf to png command
    1. pdftoppm samplepptx.pdf output -png
    2. Note : output is destination folder
  11. Step:11 Then using below functions to convert ppt to png and pdf to png
    1. PPT files first convert to pdf and then convert to png images.
    2. Pdf files directly convert to png images.

Platforms (Web, Mobile, Etc.) – Web

Technologies or frameworks or tools – NodeJs, NestJs

Platforms (Web, Mobile, Etc.) – Ubuntu

Soft Suave is a leading software provider that allows you to hire NodeJS developers with 5+ years of experience. They have immense technical skills and knowledge that help us to develop highly interactive Apps with limited budget and time. Plus, they can effectively work with top NodeJS tools like Express.js, Socket.io, Meteor, Keystone, Koa.js, PM2, Electrode.js, and Babel.

INQUIRY

Let’s get in touch

Get FREE Quote smile
OR

Got an amazing business idea?

Let's bring it to the market together.

Madhu K

Project Manager

Madhu is a Project Manager at Soft Suave, where our team develops the next-gen applications for global businesses. He will consult you on the web & mobile app development project.

Schedule a Call +1 (410) 807-8350
Get Free Estimate