LibreOffice_6.2.3.1_Win_x86 convert-to pdf --outdir root dir doesn't work & some questions

OS: windows 10 64 bit

LO --version: LibreOffice 9ba025bafb03b962c34687cf87806cc03a3a7436

i have problem with --outdir root directory

C:\Program Files (x86)\LibreOffice\program>soffice --convert-to pdf “E:\hamster.xlsx” --outdir “C:\inetpub”

output: C:\inetpub\hamster.pdf
[outdir works]

C:\Program Files (x86)\LibreOffice\program>soffice --convert-to pdf “E:\hamster.xlsx” --outdir “C:”

output: C:\Program Files (x86)\LibreOffice\program\hamster.pdf
[outdir not work]

C:\Program Files (x86)\LibreOffice\program>soffice --convert-to pdf “E:\hamster.xlsx” --outdir “E:”

output: C:\Program Files (x86)\LibreOffice\program\hamster.pdf
[outdir not work]

and some questions too:

  1. soffice --convert-to pdf “E:\hamster.xlsx” --outdir “C:\inetpub”
  2. soffice --convert-to pdf:calc_pdf_Export “E:\hamster.xlsx” --outdir “C:\inetpub”
  3. soffice --convert-to pdf:writer_pdf_Export “E:\hamster.xlsx” --outdir “C:\inetpub”
  4. soffice --convert-to pdf:writer_web_pdf_Export “E:\hamster.xlsx” --outdir “C:\inetpub”
  5. soffice --convert-to pdf:writer_globaldocument_pdf_Export “E:\hamster.xlsx” --outdir “C:\inetpub”

all of them worked, im not using --headless its run without GUI

btw what is the different between five of them (convert-to pdf, convert-to pdf:calc_pdf_Export, convert-to pdf:writer_pdf_Export, convert-to pdf:writer_web_pdf_Export, convert-to pdf:writer_globaldocument_pdf_Export)?

i found them on filters\fragments\config\source\filter - libreoffice/core - main, development code repository
is there any documentation for them?


C: and E: are not a normal paths in Windows; they mean “whatever current directory for the current process on that drive”. See this Super User question. If LibreOffice supported such paths, then your example

C:\Program Files (x86)\LibreOffice\program>soffice --convert-to pdf “E:\hamster.xlsx” --outdir “C:”
output: C:\Program Files (x86)\LibreOffice\program\hamster.pdf [outdir not work]

would be correct: you launched soffice from C:\Program Files (x86)\LibreOffice\program, so that is the current directory on drive C: for that process (and on other drives, there are own current directories).

But LibreOffice does not support such paths. So if it can’t resolve the passed path, it simply puts output to current directory (which happens to coincide with your C: path).

If you need to put files to the root of a drive, you need to add a slash, like in C:\ or C:/. There was a bug (tdf#120249) preventing LO to treat properly the syntax with trailing backslash; it’s fixed in 6.2, so should not give you problems.

Wrt export filter names - well, you need not them at all. They could be necessary only if you pass arguments to the output filter, or when a module has more than one export filter for a given extension. Each module (Writer/Calc/etc) has its own PDF export filter, named appropriately, and only one such filter per module; as Calc cannot use Writer’s export PDF filter, it simply ignores your incorrect filter name hints; and when you explicitly tell it to use calc_pdf_Export, it is redundant, because Calc would use it anyway.

Related blog post by Raymond Chen.