-
Notifications
You must be signed in to change notification settings - Fork 375
ODFDOMConverterXHTML
angelozerr edited this page Jun 20, 2015
·
1 revision
org.odftoolkit.odfdom.converter.xhtml provides the ODF 2 XHTML converter based on ODF-DOM.
You can test this converter with the REST Converter service http://xdocreport-converter.opensagres.cloudbees.net/
Download this converter with :
- maven :
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>org.odftoolkit.odfdom.converter.xhtml</artifactId>
<version>XDOCREPORT_VERSION</version>
</dependency>
where XDOCREPORT_VERSION is the XDocReport version (ex : 1.0.0).
- download the odt.converters-xxx-sample.zip
Here a sample to convert odftoolkit.odfdom.doc.OdfDocument to XHTML format :
import org.odftoolkit.odfdom.converter.xhtml.XHTMLOptions;
import org.odftoolkit.odfdom.converter.xhtml.XHTMLConverter;
...
// 1) Load ODT into ODFDOM OdfTextDocument
InputStream in= new FileInputStream(new File("HelloWord.odt"));
OdfTextDocument document = OdfTextDocument.loadDocument(in);
// 2) Prepare XHTML options (here we set the IURIResolver to load images from a "Pictures" folder)
XHTMLOptions options = XHTMLOptions.create().URIResolver(new FileURIResolver(new File("Pictures")));
// 3) Convert OdfTextDocument to XHTML
OutputStream out = new FileOutputStream(new File("HelloWord.htm"));
XHTMLConverter.getInstance().convert(document, out, options);
- IURIResolver : manage uri of image in the generated xhtml.
- IImageExtractor : extract the image.
- Overview
- Getting Started
- FAQ
- Which License Applies
- Download
- Developer's Guide
- User's Guide
- Contributor's Guide
- Acknowledgment
- Articles
- Releases