简体   繁体   English

无法使用Apache Open Office的JODconverter 2将2.1.docx转换为pdf

[英]Unable to convert .docx to pdf using JODconverter 2. 2.1 with Apache Open Office

Apache Open Office service running on port 8100 Input file is .docx 在端口8100上运行的Apache Open Office服务输入文件为.docx

OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100); 
        DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
        converter.convert(inputFile, outputFile);
        connection.disconnect();

Getting Exception 取得例外

Exception in thread "main" java.lang.IllegalArgumentException: unknown document format for file: D:\\vctest\\EDItestingprocess.docx at com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.guessDocumentFormat(AbstractOpenOfficeDocumentConverter.java:121) at com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert(AbstractOpenOfficeDocumentConverter.java:93) at com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert(AbstractOpenOfficeDocumentConverter.java:74) at com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert(AbstractOpenOfficeDocumentConverter.java:70) at com.redrock.util.ExcelToPdf.main(ExcelToPdf.java:18) 线程“主”中的异常java.lang.IllegalArgumentException:文件的未知文档格式:com上com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.guessDocumentFormat(AbstractOpenOfficeDocumentConverter.java:121)上的D:\\ vctest \\ EDItestingprocess.docx。 artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert(AbstractOpenOfficeDocumentConverter.java:93)位于com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert(AbstractOpenOfficeDocumentConverter.java:74)在com.artofconving.com。位于com.redrock.util.ExcelToPdf.main(ExcelToPdf.java:18)的AbstractOpenOfficeDocumentConverter.convert(AbstractOpenOfficeDocumentConverter.java:70)

1st start openoffice using cmd. 第一次使用cmd启动openoffice。

If you already have a servlet container/application server you can download the jodconverter-webapp-xyzzip distribution that contains a war archive ready for deployment. 如果您已经有一个servlet容器/应用程序服务器,则可以下载jodconverter-webapp-xyzzip发行版,其中包含准备部署的War归档。

For example with Tomcat 4.1 or 5.5 all you have to do is 例如,对于Tomcat 4.1或5.5,您要做的就是

optionally rename jodconverter-webapp-xyzwar to something more user-friendly since the name will be visible in the URL, eg converter.war copy it into the webapps folder inside the Tomcat installation it will be automatically deployed and visible at (tipically) http://localhost:8080/converter/ if required, configure your firewall or servlet container to restrict access to the webapp. (可选)将jodconverter-webapp-xyzwar重命名为更用户友好的名称,因为该名称将在URL中可见,例如,converter.war将其复制到Tomcat安装内的webapps文件夹中,它将自动部署并在(通常是) http: // localhost:8080 / converter /(如果需要),配置防火墙或Servlet容器以限制对Web应用程序的访问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM