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.

README.md 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # document-convert
  2. Converts `.ppt` `.pptx` `.odp` and `.key` file to `pdf or/and image(png, jpg, jpeg and etc..)`
  3. ## Dependencies
  4. Please install [libreoffice](https://www.libreoffice.org/), [imagemagick](https://www.imagemagick.org/script/index.php) and might required [ghostscript](https://www.ghostscript.com/) for Mac os
  5. **(Note: Please do restart your machine after installed all required software.)**
  6. ## LibreOffice test
  7. libreOfficePath --headless --convert-to pdf --outdir outputDir sourceFile(test.pdf),
  8. Windows
  9. ```
  10. C:\\Program Files\\LibreOffice\\program\\soffice.exe or
  11. C:\\Program Files (x86)\\LibreOffice\\program\\soffice.exe or
  12. C:\\Program Files (x86)\\LIBREO~1\\program\\soffice.exe
  13. ```
  14. Ubuntu
  15. ```
  16. /usr/bin/libreoffice or
  17. /usr/bin/soffice
  18. ```
  19. Mac OS
  20. ```
  21. /Applications/LibreOffice.app/Contents/MacOS/soffice
  22. ```
  23. ## Imagemagic test
  24. convert -verbose -resize 1200 -density 200 test.pdf test-%d.png(%d inserts the images `scene number`)
  25. ## Usage Example
  26. ```javascript
  27. // Import convert module
  28. const document = require("./convert");
  29. const options = {
  30. libreofficeBin: "C:\\Program Files\\LibreOffice\\program\\soffice.exe", // Optional
  31. sourceFile: "C:\\convert-pdf-img\\sample.pptx", // .ppt, .pptx, .odp, .key and .pdf
  32. outputDir: "C:\\convert-pdf-img\\output",
  33. img: false,
  34. imgExt: "jpg", // Default value png
  35. reSize: 800, // Default Resize is 1200
  36. density: 120, // Default density value is 120
  37. };
  38. // Convert document to pdf and/or image
  39. document.convert(options, (err, res) => {
  40. if (err) console.log(err.message);
  41. console.log(res);
  42. });
  43. ```