Convert ppt to image (png,jpg).
If you want convert powerpoint files to png or jpg images, you can do it with this script.
The package requires the following software to be installed:
- LibreOffice-dev
- ImageMagick
- pdfinfo
npm install ppt-png
Debian/Ubuntu:
sudo apt install libreoffice-dev imagemagick poppler-utils
new Converter({
files: files,
output: 'output/'
invert: true,
callback: function(data) {
console.log(data.failed, data.success, data.files, data.time);
}
}).run();
new Converter({
files: files,
output: 'output/',
invert: true,
deletePdfFile: true,
outputType: 'png',
logLevel: 2
}).wait().then(function(data) {
console.log(data.failed, data.success, data.files, data.time);
});
files: Array with the files.
output: Output folder.
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'
logLevel: Set the log level, default is 1
.
callback: Function calls when the script is ready.
The function and promise send an object to the first parameter.
{
failed: [],
success: [],
files: [],
time: 0
}
failed: An array with objects for failed converting files (file, failure, error)
success: An array with objects for converted files (page, index, name, path).
files: An array with files send to the script.
time: The total time the script was running.
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