XDocReport converting odt to pdf with OSGI

339 views
Skip to first unread message

iJava

unread,
Jul 5, 2015, 4:33:26 AM7/5/15
to xdocr...@googlegroups.com
The situation
Firstly to start to wrok witg XDocReport I want to convert odt to pdf.

All my application is OSGi. So I install the following bundles:
fr.opensagres.xdocreport.converter-1.0.5.jar
fr.opensagres.xdocreport.core-1.0.5.jar
fr.opensagres.xdocreport.document-1.0.5.jar
fr.opensagres.xdocreport.itext.extension-1.0.5.jar
fr.opensagres.xdocreport.template-1.0.5.jar

Besides in class path I have itext-4.2.1.jar (it is not osgi bundle) and I
export the following packages:
  <package name="com.lowagie.text"/>
  <package name="com.lowagie.text.factories"/>
  <package name="com.lowagie.text.pdf"/>
  <package name="com.lowagie.text.pdf.draw"/>

However, I don't get converter using the following code:
Options options = Options.getFrom(DocumentKind.ODT).to(ConverterTypeTo.PDF);
IConverter converter = ConverterRegistry.getRegistry().getConverter(options);
in = new FileInputStream(new File("/Temp/Test1.odt"));
OutputStream out = new FileOutputStream(new File("/Temp/Test1.pdf"));
converter.convert(in, out, options); //HERE I GET NullPointerException - converter is null.

Trying to solve this problem I added the following bundles:
org.odftoolkit.odfdom.converter.core-1.0.5.jar
org.odftoolkit.odfdom.converter.pdf-1.0.5.jar

However, I get :
org.osgi.framework.BundleException: Unresolved constraint in bundle org.odftoolkit.odfdom.converter.core [43]: Unable to resolve 43.0: missing requirement [43.0] osgi.wiring.package; (osgi.wiring.package=org.odftoolkit.odfdom.dom)

To solve problem with org.odftoolkit.odfdom.dom I added odfdom-java-0.8.7.jar to classpath (it is also not osgi) and export the following package
<package name="org.odftoolkit.odfdom.doc"/>

However, in spite of exporting org.odftoolkit.odfdom.doc I anyway get
org.osgi.framework.BundleException: Unresolved constraint in bundle org.odftoolkit.odfdom.converter.core [43]: Unable to resolve 43.0: missing requirement [43.0] osgi.wiring.package; (osgi.wiring.package=org.odftoolkit.odfdom.dom).

So my questions:
1)What is the reason I get null converter?
2)What library does XDocReport use itext or odfdom for converting?
3)Why is org.odftoolkit.odfdom.dom package not seen to org.odftoolkit.odfdom.converter.core although I export it?


Pascal Leclercq

unread,
Jul 7, 2015, 5:30:30 PM7/7/15
to xdocr...@googlegroups.com
Hi,

please considre using https://github.com/opensagres/xdocreport bugtracker for issues.

We have basics pax exam tests to validate xdocreport under OSGi environment see :


XDocreport has been build using iText 2.1.7

Your null pointer exception probably means that the converter has not been found in the registry but I can't say why.

Please consider using the same libs as described in the Pax Exam test.

We use itext because It's a very powerfull PDF renderer in Java.

We use odfdom because It enables us to read ODF document into a java model.

Best


--
You received this message because you are subscribed to the Google Groups "xdocreport" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xdocreport+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Pascal Leclercq

Reply all
Reply to author
Forward
0 new messages