|  | 5 年之前 | |
|---|---|---|
| test | 5 年之前 | |
| .gitignore | 5 年之前 | |
| .travis.yml | 5 年之前 | |
| README.md | 5 年之前 | |
| index.js | 5 年之前 | |
| package-lock.json | 5 年之前 | |
| package.json | 5 年之前 | |
Converts .ppt .pptx .odp and .key file to pdf or/and image(png, jpg, jpeg and etc..)
Please install libreoffice, imagemagick and might required ghostscript for Mac os (Note: Please do restart your machine after installed all required software.)
libreOfficeInstallationPath --headless --convert-to pdf --outdir outputDir sourceFile(test.pdf),
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
convert -verbose -resize 1200 -density 200 test.pdf test-%d.png(%d inserts the images scene number)
// Import convert module
const document = require("document-convert");
const options = {
  libreofficeBin: "C:\\Program Files\\LibreOffice\\program\\soffice.exe",
  sourceFile: "C:\\convert-pdf-img\\sample.pptx", // .ppt, .pptx, .odp, .key and .pdf
  outputDir: "C:\\convert-pdf-img\\output",
  img: false,
  imgExt: "jpg", // Optional and default value png
  reSize: 800, //  Optional and default Resize is 1200
  density: 120, //  Optional and default density value is 120
};
// Convert document to pdf and/or image
document
  .convert(options)
  .then((res) => {
    console.log("res", res); // Success or Error
  })
  .catch((e) => {
    console.log("e", e);
  });