Unoconv在Ubuntu 12.04服务器上无法工作

10

我正在使用unoconv将不同的文件格式转换为PDF。在我的本地计算机上,它能够很好地处理所有的格式。但是在我的Ubuntu 12.04服务器上,unoconv无法处理一些格式,例如xls、ppt、pptx等。然而,对于doc文件,它可以正常工作。对于PPT转换,它显示以下错误:

$unoconv -f pdf Googling.ppt 
unoconv: UnoException during conversion in <class '__main__.com.sun.star.lang.IllegalArgumentException'>: Unsupported URL <file:///home/pythonuser/almamapper/media/library/files/c1cb92e62ce54b29a017a6e8eaa23c/Googling.ppt>: ""
Traceback (most recent call last):
File "/usr/bin/unoconv", line 790, in <module>
main()
File "/usr/bin/unoconv", line 769, in main
convertor.convert(inputfn)
File "/usr/bin/unoconv", line 679, in convert
error("ERROR: The provided document cannot be converted to the desired format. (code: %s)" % e.ErrCode)
File "/usr/lib/python2.7/dist-packages/uno.py", line 337, in _uno_struct__getattr__
return __builtin__.getattr(self.__dict__["value"],name)
AttributeError: ErrCode

我知道我需要在我的服务器上安装openoffice-headless版本。但是从这个链接中我了解到Ubuntu已经相当长的一段时间前转向了libreoffice而不是openoffice。 因此,我通过以下命令安装了libreoffice。

apt-get install libreoffice-core libreoffice-writer libreoffice-calc

但我仍然遇到同样的错误。 我少装了些什么吗? 有没有人对此问题有任何想法?

2个回答

18

我通过安装最新版本的unoconv解决了上述问题。我尝试更新libreoffice和安装完整版本,但都没有帮助。

我使用的是unoconv 0.3,最新可用版本是0.6。因此,我安装了最新版本,并解决了该问题。

以下是我遵循的步骤:

  1. apt-get remove --purge unoconv (首先删除旧版的unoconv)
  2. git clone https://github.com/dagwieers/unoconv(下载unoconv的最新版本。)

  3. 现在cd到unoconv目录并执行sudo make install

注意:请使用git clone而不是下载tar文件。在我的情况下,当我下载tar文件时,安装失败了。


1
我发现了这篇非常优秀的博客(https://docs.moodle.org/31/en/Installing_unoconv),可以帮助你安装和设置 unoconv - Yogesh Khater

8
做了apt-get install unoconv之后,我遇到了同样的问题,安装apt-get install libreoffice可以解决它。也许您只安装了一些libreoffice组件,这就是它只能处理某些格式的原因。当然,我认为需要libreoffice-impress来转换ppt文件?

我也尝试过了。最后我通过安装最新版本的unoconv解决了这个问题。答案如下。感谢您的建议。 - Jinesh
9
我遇到了一个使用unoconv进行文档转换(-f doc)的问题。感谢 @HermanHiddema,我通过apt-get install libreoffice-writer解决了这个问题。但是我还需要杀死正在运行的soffice进程 killall soffice.bin,否则它就无法工作。 - Andre Miras
1
@AndreMiras,当尝试在Ubuntu桌面上运行此程序时,也是这种情况。我在12.04桌面环境下进行开发,并在12.04服务器上部署。如果您在LibreOffice中打开文档并尝试在命令行中转换文档,则转换将悄无声息地失败。 - chucksmash
@AndreMiras,感谢您通过提到“killall soffice.bin”来挽救这一天。我一直在想为什么我没有得到结果。 - Himel Nag Rana

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接