jodconverter
来源:互联网 发布:贵州大数据考试平台 编辑:程序博客网 时间:2024/06/10 16:16
Supported Formats
OpenOffice.org 1.0 Text (*.sxw)
Rich Text Format (*.rtf)
Microsoft Word (*.doc)
WordPerfect (*.wpd)
Plain Text (*.txt)
HTML1 (*.html)Portable Document Format (*.pdf)
OpenDocument Text (*.odt)
OpenOffice.org 1.0 Text (*.sxw)
Rich Text Format (*.rtf)
Microsoft Word (*.doc)
Plain Text (*.txt)
HTML2 (*.html)
MediaWiki wikitext (*.wiki)Spreadsheet FormatsOpenDocument Spreadsheet (*.ods)
OpenOffice.org 1.0 Spreadsheet (*.sxc)
Microsoft Excel (*.xls)
Comma-Separated Values (*.csv)
Tab-Separated Values (*.tsv)Portable Document Format (*.pdf)
OpenDocument Spreadsheet (*.ods)
OpenOffice.org 1.0 Spreadsheet (*.sxc)
Microsoft Excel (*.xls)
Comma-Separated Values (*.csv)
Tab-Separated Values (*.tsv)
HTML2 (*.html)Presentation FormatsOpenDocument Presentation (*.odp)
OpenOffice.org 1.0 Presentation (*.sxi)
Microsoft PowerPoint (*.ppt)Portable Document Format (*.pdf)
Macromedia Flash (*.swf)
OpenDocument Presentation (*.odp)
OpenOffice.org 1.0 Presentation (*.sxi)
Microsoft PowerPoint (*.ppt)
HTML2 (*.html)Drawing FormatsOpenDocument Drawing (*.odg)Scalable Vector Graphics (*.svg)
Macromedia Flash (*.swf)
Starting OpenOffice.org as a service
%OpenOffice_home%/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard
Usage as a Command Line Tool
To use JODConverter from the command line, download the jodconverter-2.2.0.zip distribution, unpack and execute the jodconverter-cli-2.2.0.jar JAR with java.
To convert a single file specify input and output files as parameters
java -jar lib/jodconverter-cli-2.2.0.jar document.doc document.pdf
To convert multiple files to a given format specify the format using the -f (or --output-format) option and then pass the input files as parameters
java -jar lib/jodconverter-cli-2.2.0.jar -f pdf *.odt
Usage as a Java Library
Submitted by mirko on 13 February 2007 - 3:35pmUsing JODConverter in your own Java application is very straightforward. The following example shows the skeleton code required to perform a one off conversion from a Word document to PDF:
File inputFile = new File("document.doc");File outputFile = new File("document.pdf"); // connect to an OpenOffice.org instance running on port 8100OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100);connection.connect(); // convertDocumentConverter converter = new OpenOfficeDocumentConverter(connection);converter.convert(inputFile, outputFile); // close the connectionconnection.disconnect();
To convert from/to other formats, simply change the file names and the formats will be determined based on file extensions; e.g. to convert an Excel file to OpenDocument Spreadsheet:
File inputFile = new File("spreadsheet.xls");File outputFile = new File("spreadsheet.ods");converter.convert(inputFile, outputFile);
Simple, isn't it? Yet this example actually shows almost everything you need to know for most applications.
Almost because establishing a new connection each time you need to do a conversion, while perfectly acceptable, is not the best idea from a performance point of view.If you're integrating JODConverter in a web application for example you may want to initialise a single OpenOfficeConnection instance when the app is started and disconnect it when the app is stopped.
There are many different ways to do this depending on which web framework (if any) you're using so I'm not going to explain it here. For plain Servlet API you can use a context listener, for Spring you can initialise the OpenOfficeConnection and DocumentConverter beans in your applicationContext.xml, and so on.
- jodconverter
- jodconverter already running问题解决
- 文档格式转换--JodConverter
- JODConverter - 文件格式轉換的利器
- [JODConverter]word轉pdf心得分享 (轉)
- 使用JODConverter转换文档为PDF
- JodConverter纯文本文件转PDF乱码问题
- JAVA OpenOffice+jodconverter转换WORD为PDF
- java操作word by poi jodconverter
- 解决jodconverter无法兼容libreoffice4的解决方案
- jodconverter纯文本文件转为pdf时中文问题解决方案
- OpenOffice配合jodconverter多线程转换文件socket出现异常
- 仿百度文库解决方案之四:JODConverter调用转换
- J2EE--运用JODConverter进行doc、ppt到pdf的转换
- openoffice3+Pdf2Swf tool+Jodconverter+FlexPaper实现文档在线预览
- 利用openoffice+jodconverter-code-3.0-bate4 把ppt转图片
- (二)使用JODConverter将office文档转换为pdf
- openoffice jodconverter 文档转换pdf过坑记录
- 博客迁移
- 跟后台打印程序系统服务通讯时出现错误解决方法
- 理解mysql字符集(mysql 5.6)
- Android FoldingLayout 折叠布局 原理及实现(一)(转)
- Android开发笔记之adb参数指南
- jodconverter
- 【C#】高级语言特有的单例模式
- org.springframework.dao.DataIntegrityViolationException
- python常见注意事项
- 免费的天气预报API接口--谷歌,雅虎,中央气象台
- Linux命令
- 如何在Ubuntu(服务器)装JDK,Tomcat,MySQL
- 详解C语言printf函数以及%占位符知识
- 01背包问题总结