PyODConverter-文档转换- uu.Net - 博客园

PyODConverter
PyODConverter, for Python OpenDocument Converter, is a Python script that automates office

document conversions from the command line using OpenOffice.org.

The script does basically the same thing as the command line tool that comes with JODConverter

but is much simpler. In fact the Python script was released for the people who use JODConverter

only from the command line (not as a Java library or web service) and would like a simpler

alternative.

是一个使用openoffice.org从命令行下转换文档的python脚本
这个脚本能更简单的实现和JODConverter想通在命令行下的基本转换;事实上,它的发布是为了那些只在命令

行下使用JODConverter的人们(而不是一个java库或者一个web服务)。它将是一个简单的替代方案。

Usage
Just like JODConverter, PyODConverter requires OpenOffice.org to be running as a service and

listening on port (by default) 8100; the simples way to start OpenOffice.org as a service is

from the command line

> "C:\Program Files\OpenOffice.org 2.2\program\soffice" -accept="socket,port=8100;urp;"
The script expects exactly 2 parameters: an input and an output file names. The document formats

are inferred from the file extensions.

Since it uses the Python/UNO bridge, the script requires the UNO modules to be already present

in your Python installation. Most of the time this means you need to use the Python version

installed with OpenOffice.org, e.g. on Windows

> "C:\Program Files\OpenOffice.org 2.2\program\python" DocumentConverter.py test.odt test.pdf
or on Linux

$ /opt/openoffice.org2.2/program/python DocumentConverter.py test.PPT test.pdf

用法:
同JODConverter一样,PyODConverter需要Openoffice.org作为一个服务监听一个端口(默认的是8100),从

命令行下启动服务最简单的方法如下:
for windows:
>"c:\Program Files\OpenOffice.org 2.3\program\soffice" -accept="socket,port=8100;urp;"

因为该使用python-UNO桥,要运行PyODConverter你需要安装pyhon的时候安装了UNO模块,大多数情况下当你

安装OpenOfiice.org的时候附带安装的python就可以。(通过Python-UNO桥,您可以通过Python使用标准的

OpenOffice.org API. 同时允许您使用Python编写UNO组建,这样python UNO 组建可以在Office进程中运行,

而且可被Java, C++ 和StarBisic脚本调用.)

这个脚本有两个必要的参数:一个输入文件名和一个输出文件名,文档的类型取决于文件的扩展名
在windows上:
> "C:\Program Files\OpenOffice.org 2.2\program\python" DocumentConverter.py test.odt test.pdf

在linux上,命令如下:
$ /opt/openoffice.org2.3/program/python DocumentConverter.py test.ppt test.pdf
注意DocumentConverter.py的路径,PyODConverter也可以用做python module,用于你自己的脚本。如下我将它用于php脚本

>vi convert.php

<?php

   system("/opt/openoffice.org3/program/python DocumentConverter.py test.ppt test.swf");
?>

>/usr/local/php5/bin/php convert.php

郑重声明:资讯 【PyODConverter-文档转换- uu.Net - 博客园】由 发布,版权归原作者及其所在单位,其原创性以及文中陈述文字和内容未经(企业库qiyeku.com)证实,请读者仅作参考,并请自行核实相关内容。若本文有侵犯到您的版权, 请你提供相关证明及申请并与我们联系(qiyeku # qq.com)或【在线投诉】,我们审核后将会尽快处理。
—— 相关资讯 ——