在UNO LibreOffice中使用writer_pdf_Export过滤器时出现问题

时间:2018-11-15 10:35:39

标签: libreoffice uno

我在Ubuntu 16.03上安装了LibreOffice [LibreOffice 6.1.3.2 10(Build:2)]和sdk。

我使用了sdk包中的java示例DocumentConverter来转换不同格式的odt。

使用“ MS WORD 97”或“文本”没有问题,但是使用“ writer_pdf_Export”则以“异常”结尾

java -jar /home/js/libreoffice6.1_sdk/LINUXexample.out/class/JavaDocumentHandlingExamples/DocumentConverter.jar "./test" "MS WORD 97" "doc" "/home/js/libreoffice6.1_sdk/LINUXexample.out/misc/JavaDocumentHandlingExamples/converted_files"
Connected to a running office ...

The converted documents will stored in "/home/js/libreoffice6.1_sdk/LINUXexample.out/misc/JavaDocumentHandlingExamples/converted_files!
[test]
   test1.odt

KO

java -jar /home/js/libreoffice6.1_sdk/LINUXexample.out/class/JavaDocumentHandlingExamples/DocumentConverter.jar "./test" "writer_pdf_Export" "pdf" "/home/js/libreoffice6.1_sdk/LINUXexample.out/misc/JavaDocumentHandlingExamples/converted_files"
Connected to a running office ...

The converted documents will stored in "/home/js/libreoffice6.1_sdk/LINUXexample.out/misc/JavaDocumentHandlingExamples/converted_files!
[test]
com.sun.star.task.ErrorCodeIOException: SfxBaseModel::impl_store <file:////home/js/libreoffice6.1_sdk/LINUXexample.out/misc/JavaDocumentHandlingExamples/converted_files/test1.pdf> failed: 0x81a(Error Area:Io Class:Parameter Code:26)
    at   com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Job.java:158)
    at com.sun.star.lib.uno.environments.remote.Job.execute(Job.java:122)
    at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:312)
    at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:281)
    at com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter(JavaThreadPool.java:81)
    at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:618)
    at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.request(ProxyFactory.java:145)
    at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(ProxyFactory.java:129)
    at com.sun.proxy.$Proxy5.storeAsURL(Unknown Source)
    at DocumentConverter.traverse(DocumentConverter.java:137)
    at DocumentConverter.main(DocumentConverter.java:216)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.sun.star.lib.loader.Loader.main(Loader.java:132)
  test1.odt

我需要通过Java使用UNO接口将其转换为任何格式,并且我真的也需要pdf ... 有帮助吗?

1 个答案:

答案 0 :(得分:0)

您正在执行“ storeAsURL”还是“ storeToURL”?

“ storeAsURL”类似于“另存为”-用于以可编辑格式保存文档时。

“ storeToURL”类似于“导出”-用于生成不可编辑格式的输出。

所以我怀疑,如果您从“ storeAsURL”切换为“ storeToURL”,则会得到所需的PDF。