strange error when I convert ODT to PDF

2.8k views Asked by At

I want convert a Odt document to pdf using xdocReport.

I downloaded odt.converters-1.0.3-sample.zip from there and I created a project with all his lib jars:

fr.opensagres.xdocreport.itext.extension-1.0.3.jar
itext-2.1.7.jar
odfdom-java-0.8.7.jar
org.odftoolkit.odfdom.converter.core-1.0.3.jar
org.odftoolkit.odfdom.converter.pdf-1.0.3.jar
org.odftoolkit.odfdom.converter.xhtml-1.0.3.jar
xercesImpl-2.9.1.jar
xml-apis-1.3.04.jar

My code is

OdfTextDocument document = OdfTextDocument.loadDocument("c:\\teste_odt_to_pdf\\documento2.odt"); 
File outFile = new File("c:\\teste_odt_to_pdf\\documento2.pdf"); 
OutputStream out = new FileOutputStream( outFile ); 
PdfConverter.getInstance().convert(document, out, PdfOptions.create()); 

and I got the following error:

Exception in thread "main" java.lang.NoSuchMethodError: com.lowagie.text.Paragraph.getSpacingBefore()F
    at fr.opensagres.xdocreport.itext.extension.ExtendedParagraph.setSpacingBefore(ExtendedParagraph.java:164)
    at org.odftoolkit.odfdom.converter.pdf.internal.ElementVisitorForIText.processParagraphOrHeading(ElementVisitorForIText.java:380)
    at org.odftoolkit.odfdom.converter.pdf.internal.ElementVisitorForIText.visit(ElementVisitorForIText.java:320)
    at org.odftoolkit.odfdom.dom.element.text.TextPElement.accept(TextPElement.java:1681)
    at org.odftoolkit.odfdom.converter.core.ElementVisitorConverter.visit(ElementVisitorConverter.java:82)

I tested with many different documents and I got the same error. I use jdk 1.6

0

There are 0 answers