使用如下命令可以将文档一次性批量导出为pdf格式:

find ./ -maxdepth 1 -name "*.odt" -print0 | xargs -0 -I '{}' /cygdrive/d/Program\ Files\ \(x86\)/LibreOffice\ 4/program/soffice.exe --headless --convert-to pdf '{}'

find命令的-maxdepth选项指定搜索文档时的目录深度。其值为1时,只在当前路径下搜索。本想着是否可以用*.odt通配符的形式传给soffice作参数,但是至少在Windows下不管用。所以只能借助于xargs,使用一条命令一次转换多个文件。

时,需要注意的时,在调用soffice命令前,要关闭所有的LibreOffice程序。

相关文章:

  • 2021-05-26
  • 2021-09-16
  • 2022-12-23
  • 2022-02-07
  • 2022-02-24
  • 2022-01-01
  • 2022-02-09
  • 2021-04-16
猜你喜欢
  • 2021-11-18
  • 2021-12-09
  • 2021-12-28
  • 2021-08-27
  • 2022-12-23
  • 2022-01-13
  • 2021-11-15
相关资源
相似解决方案