JODConverter的问题并以无头模式运行LibreOffice [英] Issue with JODConverter and running LibreOffice in headless mode

查看:612
本文介绍了JODConverter的问题并以无头模式运行LibreOffice的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码使用JOD将.doc转换为.pdf.

I am using the following code to convert .doc to .pdf using JOD.

File inputFile = new File("document.doc");
File outputFile = new File("document.pdf");

// connect to an OpenOffice.org instance running on port 8100
OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100);
connection.connect();

// convert
DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
converter.convert(inputFile, outputFile);

// close the connection
connection.disconnect();

但是我必须跑步

soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard

分别以无头模式启动LibreOffice.

separately to start LibreOffice in headless mode.

有没有办法以编程方式启动LibreOffice?或者,我们不能仅将LibreOffice文件夹的路径提供给JOD来进行转换吗?

Is there a way to start LibreOffice programmatically? Or, can't we just give the path to LibreOffice folder to JOD to do the conversion?

推荐答案

您完全不需要JOD即可将doc文件转换为PDF.这可以直接通过LibreOffice完成:

You don't need JOD at all to convert a doc file to a PDF. This can be directly done with LibreOffice:

libreoffice --headless --convert-to pdf document.doc

这篇关于JODConverter的问题并以无头模式运行LibreOffice的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆