Closed soubhikchatterjee closed 2 years ago
Unfortunately I got the same error
@soubhikchatterjee @randomcrafterHD What version of rimraf do you have installed? It seams like a bug in rimraf on Windows.
Previously i think 2.6 but after that didn't work i switched to 3.0.2 with the same result
Okay just for those who have the same issue... it's a little bit embarrassing, but in my case the libreoffice installation was broke... reinstalling fixed the issue :)
continue with the same problem, I already installed it again
okay strange... you could also try to perform the command without the library ... then there should be no error concerning the deletion, but you have to take care about the location etc. yourself
In my case i wanted to convert word to pdf on windows start /wait soffice --headless --convert-to pdf "{WORD_INPUT_FILE}" --outdir "{PDF_OUTPUT_FOLDER}" the "start /wait" part is windows specific...
I have the same problem
I don't have Windows. @all please write a fix MR, I will review and accept it!
Am 8. Juli 2020 14:41:26 MESZ schrieb horsul notifications@github.com:
I have the same problem
Workaround that works for me: Run nodejs server on Windows subsystem for Linux (WSL 2, https://docs.microsoft.com/en-us/windows/wsl/wsl2-index)
我测试后的方法,是将libreoffice软件安装到c盘的C:\Program Files\LibreOffice\program目录下面即可
+1
As of today, I also have the same problem. I want to convert word to pdf
+
@bdevpro It doesn't help to push on this issue. As I wrote on the 8th of july, I don't have Windows and I don't plan to install it. Please search and fix this bug yourself and post a MR, I will review and merge and upload new versions.
@bdevpro It doesn't help to push on this issue. As I wrote on the 8th of july, I don't have Windows and I don't plan to install it. Please search and fix this bug yourself and post a MR, I will review and merge and upload new versions.
Thank you ) I will try to solve it
If it can help anyone, I stumbled into the same issue because libreoffice wasn't installed on the computer. After libreoffice was installed, I run into the other issue #32, but with the fix mentioned there, it finally works now
I am use windows and also have same experience about this error,
like what @JCLimpide said, so make sure you have install libreoffice on your system.
also for @elwerene I have suggestion to make config/options for custom installation path because I installed libreoffice in D drive. I will make pull request if have free time.
thanks.
@ghostvar make a pull request and I will review and release it :)
Hi everybody, I ran into the same error... I had not read the requirements "Please install libreoffice in /Applications (Mac), with your favorite package manager (Linux), or with the msi (Windows)". Download and install works for me: https://www.libreoffice.org/donate/dl/win-x86_64/7.2.0/pt/LibreOffice_7.2.0_Win_x64.msi
Bye
OS: Windows Server 2019 Node: v14.4.0 npm: 6.14.5
My Code:
const libre = require('libreoffice-convert'); const path = require('path'); const fs = require('fs'); const extend = '.pdf' const enterPath = path.join(__dirname, '/input/CAD 00001.docx'); const outputPath = path.join(__dirname, `/output/example${extend}`); // Read file 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) { return 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); });
$ node converter.js C:\PROJECTS\test\node_modules\rimraf\rimraf.js:310 throw er ^ Error: ENOTEMPTY: directory not empty, rmdir 'C:\Users\VIPUL_~1\AppData\Local\Temp\2\libreofficeConvert_-1312-rs7W0TWfuZDn' ?[90m at Object.rmdirSync (fs.js:865:3)?[39m at rmkidsSync (C:\PROJECTS\test\node_modules\?[4mrimraf?[24m\rimraf.js:349:27) at rmdirSync (C:\PROJECTS\test\node_modules\?[4mrimraf?[24m\rimraf.js:329:7) at rimrafSync (C:\PROJECTS\test\node_modules\?[4mrimraf?[24m\rimraf.js:301:9) at Object._cleanupCallback [as removeCallback] (C:\PROJECTS\test\node_modules\?[4mtmp?[24m\lib\tmp.js:356:16) at C:\PROJECTS\test\node_modules\?[4mlibreoffice-convert?[24m\index.js:59:17 at C:\PROJECTS\test\node_modules\?[4masync?[24m\dist\async.js:473:16 at C:\PROJECTS\test\node_modules\?[4masync?[24m\dist\async.js:1622:17 at C:\PROJECTS\test\node_modules\?[4masync?[24m\dist\async.js:969:16 at C:\PROJECTS\test\node_modules\?[4mlibreoffice-convert?[24m\index.js:35:32 { errno: ?[33m-4051?[39m, syscall: ?[32m'rmdir'?[39m, code: ?[32m'ENOTEMPTY'?[39m, path: ?[32m'C:\\Users\\VIPUL_~1\\AppData\\Local\\Temp\\2\\libreofficeConvert_-1312-rs7W0TWfuZDn'?[39m }
However the above code works fine on macos.
I got the similar error on windows. after struggling for hours the solution is simple. In libreOffice>index.js line #17 to #71, make sure the paths is correct. In my case I had to add 'programfiles' instead of 'programfiles(86)'. Depending on the windows version your path will vary. I hope this helps anyone
Thank you
On Mon, Aug 22, 2022, 11:35 AM WafiqSalie @.***> wrote:
OS: Windows Server 2019 Node: v14.4.0 npm: 6.14.5
My Code:
const libre = require('libreoffice-convert');
const path = require('path'); const fs = require('fs');
const extend = '.pdf' const enterPath = path.join(dirname, '/input/CAD 00001.docx'); const outputPath = path.join(dirname,
/output/example${extend}
);// Read file 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) { return 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);
});
$ node converter.js C:\PROJECTS\test\node_modules\rimraf\rimraf.js:310 throw er ^
Error: ENOTEMPTY: directory not empty, rmdir 'C:\Users\VIPUL~1\AppData\Local\Temp\2\libreofficeConvert-1312-rs7W0TWfuZDn' ?[90m at Object.rmdirSync (fs.js:865:3)?as removeCallback at rmdirSync (C:\PROJECTS\test\node_modules\?[4mrimraf?[24m\rimraf.js:329:7) at rimrafSync (C:\PROJECTS\test\node_modules\?[4mrimraf?[24m\rimraf.js:301:9) at Object._cleanupCallback [as removeCallback] (C:\PROJECTS\test\node_modules\?[4mtmp?[24m\lib\tmp.js:356:16) at C:\PROJECTS\test\node_modules\?[4mlibreoffice-convert?[24m\index.js:59:17 at C:\PROJECTS\test\node_modules\?[4masync?[24m\dist\async.js:473:16 at C:\PROJECTS\test\node_modules\?[4masync?[24m\dist\async.js:1622:17 at C:\PROJECTS\test\node_modules\?[4masync?[24m\dist\async.js:969:16 at C:\PROJECTS\test\nodemodules\?[4mlibreoffice-convert?[24m\index.js:35:32 { errno: ?[33m-4051?[39m, syscall: ?[32m'rmdir'?[39m, code: ?[32m'ENOTEMPTY'?[39m, path: ?[32m'C:\Users\VIPUL~1\AppData\Local\Temp\2\libreofficeConvert_-1312-rs7W0TWfuZDn'?[39m }
However the above code works fine on macos.
I got the similar error on windows. after struggling for hours the solution is simple. In libreOffice>index.js line #17 https://github.com/elwerene/libreoffice-convert/issues/17 to #71 https://github.com/elwerene/libreoffice-convert/issues/71, make sure the paths is correct. In my case I had to add 'programfiles' instead of 'programfiles(86)'. Depending on the windows version your path will vary. I hope this helps anyone
— Reply to this email directly, view it on GitHub https://github.com/elwerene/libreoffice-convert/issues/28#issuecomment-1221909746, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQM7YQ2APBSMC64UM2EWFBTV2MNRHANCNFSM4N7OSYMA . You are receiving this because you were mentioned.Message ID: @.***>
Came across the same issue on windows. Installed LibreOffice and checked the file path mentioned in the node module to make it work.
Code looks like:
const libre = require('libreoffice-convert');
libre.convertAsync = require('util').promisify(libre.convert);
const pdfBuf = await libre.convertAsync(doc.getZip().generate({
type: "nodebuffer",
mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
}), 'pdf', undefined);
And then I proceeded with using the buffer according to my use case. Thank you for sharing the resources in the above comments, it helped a lot! Cheers!
OS: Windows Server 2019 Node: v14.4.0 npm: 6.14.5
My Code:
However the above code works fine on macos.