t’s new! It’s here! It’s the best JODConverter release available.
The version number even matches the latest OpenOffice.org version, but that’s pure coincidence.
- More flexibility in setting custom conversion options, including export options, import options, and macro execution flags.
- Preconfigured support for more formats: CSV and TSV (Comma-Separated and Tab-Separated Values); ODG (OpenDocument Drawing), also exportable to SVG.
- Command Line: you can now convert multiple files at once
java -jar jodconverter-cli-2.2.0.jar -f pdf *.odt
will convert all OpenDocument Text files in the current directory to PDF.
Upgrading from v2.1.1
JODConverter now uses slf4j instead of commons-logging (to avoid classloader headaches); if you embed JODConverter in your own web applications make sure you provide your favourite slf4j implementation (such as slf4j-log4j12 or slf4j-jdk14) in the classpath in addition to slf4j-api.jar. Read the slf4j documentation for more.
The API for specifying custom export options has changed (the previous API basically worked well only for PDF and had to be modified). Now you can specify any property that will be passed to OpenOffice.org in the MediaDescriptor when exporting the document, and separately for each DocumentFamily. If you were specifying custom PDF options as
DocumentFormat pdf = ... pdf.setExportOption("ExportBookmarks", Boolean.TRUE);
the code will have to be changed as follows
DocumentFormat pdf = ... Map<String,Object> pdfOptions = new HashMap<String,Object>(); // generics not required pdfOptions.put("ExportBookmarks", Boolean.TRUE); pdf.setExportOption("FilterData", pdfOptions);
(The increased complexity for PDF is due to the increased flexibility: now you can specify any property, not just “FilterData” which was implicitly assumed in the previous version.)
As a result of the change above, old XML format configuration files (document-formats.xml) unfortunately will not work with the new version.
XmlDocumentFormatRegistry is not the default registry any more; instead the pure Java DefaultDocumentFormatRegistry is used if you don’t specify a custom registry to the DocumentConverter. In fact, if you don’t use XmlDocumentFormatRegistry then you don’t need xstream in your classpath any more. This change should be transparent but it’s worth mentioning.
Here’s the complete ChangeLog (as generated by Jira):
- [JODC-14] – Incorrect Excel mime-type
- [JODC-16] – Failure when converting from .txt files with different line endings
- [JODC-18] – File extension should be treated as case insensitive
- [JODC-5] – Add macro execution options
- [JODC-10] – Make XStream dependency optional
- [JODC-11] – Replace commons-logging with slf4j
- [JODC-17] – Add CSV to default formats
- [JODC-19] – Revise DocumentFormat exportOptions API
- [JODC-20] – Make document formats easily customisable in webapp
- [JODC-22] – Add DocumentFamily.DRAWING
- [JODC-9] – IKVM compatibility to build as a .NET DLL
- [JODC-13] – Add support for converting multiple files at once in ConvertDocument command line tool
- [JODC-21] – Split CLI into separate module