So, I am using the libreoffice-convert, running in my nodejs application of course. My code as below
const file = fs.readFileSync(enterPath);
// Convert it to pdf format with undefined filter (see Libreoffice doc about filter)
libre.convert(file, extend, undefined, (err, done) => {
if (err) {
console.log(`Error converting file: ${err}`);
}
// Here in done you have pdf file which you can save or transfer in another stream
fs.writeFileSync(outputPath, done);
});
The code above returns an error when it tries to open LibreOffice.
The application cannot be started.
The configuration file "C:\Program Files\LibreOffice\program\bootstrap.ini" is corrupt.
This is the content of my bootstrap.ini
[Bootstrap]
InstallMode=<installmode>
ProductKey=LibreOffice 7.0
UserInstallation=$SYSUSERCONFIG/LibreOffice/4
Really appreciate if anyone could help to solve this. Also not sure if it helps, but I am running it on Windows.
In case if someone is facing the same issue as I did, here's what I did to solve it.
npm i libreoffice-convert
, go to your_project/node_modules/libreoffice-convert/index.js
, find the code below./* your_project/node_modules/libreoffice-convert/index.js */
let command = `-env:UserInstallation=file://${installDir.name} --headless --convert-to ${format}`;
// change to
let command = `${installDir.name} --headless --convert-to ${format}`;