Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ppt-png

w3nl733MIT2.1.4

Convert ppt to image (png,jpg)

javascript, ppt, pptx, powerpoint, png, jpg, jpeg

readme

ppt-png

Convert ppt to image (png,jpg).

NPM version Downloads Quality Gate Status Bugs Code Smells Coverage

If you want convert powerpoint files to png or jpg images, you can do it with this script.

Requirements

The package requires the following software to be installed:

  • LibreOffice-dev
  • ImageMagick
  • pdfinfo

Installation

Minimum node version: 18

`npm install ppt-png`

Debian/Ubuntu:

`sudo apt install libreoffice-dev imagemagick poppler-utils`

Mac:

`brew install imagemagick poppler ghostscript`

Basic Usage (node.js)

import Converter from 'ppt-png'

const converter = Converter.create({
    files:  ['test/OPW 733 Tienduizend redenen.ppt'],
    output: 'output/'
});

const result = converter.convert();

files: Array with the files.

output: Output folder.

ImageMagick settings

Image Magick can crash with segmentation fault (core dumped) or other errors. If you have more memory available, you can increase the memory default limits.

# Configure ImageMagick for PDF conversion with increased memory limits
RUN if [ -f /etc/ImageMagick-6/policy.xml ]; then \
  sed -i 's/<policy domain="resource" name="memory" value="256MiB"\/>/<policy domain="resource" name="memory" value="2GiB"\/>/g' /etc/ImageMagick-6/policy.xml && \
  sed -i 's/<policy domain="resource" name="disk" value="1GiB"\/>/<policy domain="resource" name="disk" value="4GiB"\/>/g' /etc/ImageMagick-6/policy.xml; \
  fi

Todo:

invert: Invert the colors, default is false;

greyscale: Greyscale the colors, default is false;

deletePdfFile: Delete the pdf file after converting, default is true.

outputType: Output type, default is png, but jpg is also possible.

documentConvert: Overrule the document convert command, default is 'libreoffice --headless --convert-to pdf --outdir'

density: Density setting to convert the PDF to image at, defaults to 96 DPI

width: Width of the output images if density is not used

height: Height of the output images if density is not used

logLevel: Set the log level, default is 1.

Test the package.

npm test

This will run all the tests in the test folder with mocha.

If you only want to check the eslint rules, just run.

npm run lint

changelog

0.7.3 2020-12-23

  • Made it possible to add density and width and height

0.8.0 2020-12-18

  • Refactor so the code is more testable and readable

0.7.2 2020-12-18

  • Fix the density

0.7.1 2020-10-09

  • Dont check logLevel for failed results

0.7.0 2020-09-01

  • Add Windows support

0.6.0 2020-07-04

  • Fix for the output in the convert method

0.5.6 2020-02-14

  • Add instructions and support for Mac
  • Add support for specifying PDF -> Image density or size
  • Update dependencies in yarn.lock

0.5.3 2019-08-16

  • Add more tests

0.5.2 2019-08-16

  • More information about converting errors

0.5.1 2019-08-14

  • Fix the package json

0.5.0 2019-08-14

  • Dont use pdf2image package

0.4.5 2019-08-13

  • Upgrade the array-helpers package

0.4.4 2019-08-13

  • Auto fixes from GitHub to fix potential security vulnerabilities.

0.4.3 2019-08-13

  • Update all dependencies.

0.4.2 2019-07-04

  • Add a space after the document convert comnmand

0.4.1 2019-07-03

  • Document convert overrule details added

0.4.0 2019-07-03

  • Now you are more flexible with the document convert command

0.3.0 2019-06-07

  • Update all dependencies.

0.2.4 - 2018-10-08

  • Update the array helper package.

0.2.3 - 2018-10-06

  • Fix Travis CI.

0.2.2 - 2018-10-04

  • Code cleanup.

0.2.1 - 2018-10-04

  • Fix dependencies after audit check.

0.2.0 - 2018-10-04

  • Use the libreoffice converter, remove unoconv.

0.1.5 - 2017-09-07

  • Use array-helpers package.

0.1.4 - 2017-09-07

  • Check code with mocha tests.
  • Use coveralls.

0.1.3 - 2017-09-07

  • Use travis.
  • Add link to npm stats.

0.1.2 - 2017-09-06

  • Return success and failed files.
  • run contains the promise parameters, was on the next function.
  • More error details.
  • pdf2image error logged.