| ## Usage Example | ## Usage Example | ||||
| ```javascript | |||||
| // Import convert module | // Import convert module | ||||
| const document = require("./convert"); | const document = require("./convert"); | ||||
| // `.ppt,` `.pptx`, `.odp` and `.key` to pdf and/or image convert options | // `.ppt,` `.pptx`, `.odp` and `.key` to pdf and/or image convert options | ||||
| const options = { | const options = { | ||||
| libreofficeBin: "C:\\Program Files\\LibreOffice\\program\\soffice.exe", // This is optional if it is null it will find default installation path inn your OS | |||||
| sourceFile: "C:\\convert-pdf-img\\sample.pptx", | |||||
| outputDir: "C:\\convert-pdf-img\\abc", | |||||
| img: true, | |||||
| imgExt: "jpg", | |||||
| reSize: 800, | |||||
| density: 120, | |||||
| libreofficeBin: "C:\\Program Files\\LibreOffice\\program\\soffice.exe", // This is optional if it is null it will find default installation path inn your OS | |||||
| sourceFile: "C:\\convert-pdf-img\\sample.pptx", | |||||
| outputDir: "C:\\convert-pdf-img\\abc", | |||||
| img: true, | |||||
| imgExt: "jpg", | |||||
| reSize: 800, | |||||
| density: 120, | |||||
| }; | }; | ||||
| // Document (`.ppt,` `.pptx`, `.odp` and `.key`) to pdf and/or image convert options | // Document (`.ppt,` `.pptx`, `.odp` and `.key`) to pdf and/or image convert options | ||||
| const options = { | const options = { | ||||
| libreofficeBin: "C:\\Program Files\\LibreOffice\\program\\soffice.exe", // This is optional if it is null it will find default installation path inn your OS | |||||
| sourceFile: "C:\\convert-pdf-img\\sample.pdf", | |||||
| outputDir: "C:\\convert-pdf-img\\", | |||||
| img: true, | |||||
| imgExt: "jpg", | |||||
| reSize: 800, | |||||
| density: 120, | |||||
| libreofficeBin: "C:\\Program Files\\LibreOffice\\program\\soffice.exe", // This is optional if it is null it will find default installation path inn your OS | |||||
| sourceFile: "C:\\convert-pdf-img\\sample.pdf", | |||||
| outputDir: "C:\\convert-pdf-img\\", | |||||
| img: true, | |||||
| imgExt: "jpg", | |||||
| reSize: 800, | |||||
| density: 120, | |||||
| }; | }; | ||||
| // Convert document to pdf and/or image | // Convert document to pdf and/or image | ||||
| document.convert(options, (err, res) => { | document.convert(options, (err, res) => { | ||||
| if (err) console.log(err.message); | |||||
| console.log(res); | |||||
| if (err) console.log(err.message); | |||||
| console.log(res); | |||||
| }); | }); | ||||
| ``` |