You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Kalimuthu Selvaraj 0246fa8d97 Updated .readme file and test logic. 5 lat temu
source Updated .readme, package.json and core files. 5 lat temu
test Updated .readme file and test logic. 5 lat temu
.gitignore Updated .readme file and test logic. 5 lat temu
README.md Updated .readme file and test logic. 5 lat temu
convert.js Updated .readme file and test logic. 5 lat temu
package-lock.json Updated .readme file and test logic. 5 lat temu
package.json Updated .readme, package.json and core files. 5 lat temu

README.md

document-convert

Converts .ppt .pptx .odp and .key file to pdf or/and image(png, jpg, jpeg and etc..)

Dependencies

Please install libreoffice, imagemagick and might required ghostscript for Mac os (Note: Please do restart your machine after installed all required software.)

LibreOffice test

libreOfficeInstallationPath --headless --convert-to pdf --outdir outputDir sourceFile(test.pdf),

LibreOffice Installation Path

Windows

C:\\Program Files\\LibreOffice\\program\\soffice.exe (or)
C:\\Program Files (x86)\\LibreOffice\\program\\soffice.exe (or)
C:\\Program Files (x86)\\LIBREO~1\\program\\soffice.exe

Ubuntu

/usr/bin/libreoffice (or)
/usr/bin/soffice

Mac OS

/Applications/LibreOffice.app/Contents/MacOS/soffice

Imagemagic test

convert -verbose -resize 1200 -density 200 test.pdf test-%d.png(%d inserts the images scene number)

Usage Example

// Import convert module
const document = require("./convert");

const options = {
  libreofficeBin: "C:\\Program Files\\LibreOffice\\program\\soffice.exe", // Optional
  sourceFile: "C:\\convert-pdf-img\\sample.pptx", // .ppt, .pptx, .odp, .key and .pdf
  outputDir: "C:\\convert-pdf-img\\output",
  img: false,
  imgExt: "jpg", // Default value png
  reSize: 800, // Default Resize is 1200
  density: 120, // Default density value is 120
};

// Convert document to pdf and/or image
document.convert(options, (err, res) => {
  if (err) console.log(err.message);
  console.log(res);
});