Java 使用xdocReport将.odt转换为.pdf时发生VerifyError
我必须将odt文件转换为pdf文件。为此,我使用XdocReport 我的代码如下:Java 使用xdocReport将.odt转换为.pdf时发生VerifyError,java,pdf,odt,xdocreport,odfdom,Java,Pdf,Odt,Xdocreport,Odfdom,我必须将odt文件转换为pdf文件。为此,我使用XdocReport 我的代码如下: public static void convertOdtToPdf(String inputFilename , String outputFilename) throws Exception{ InputStream in= new FileInputStream(new File(inputFilename)); OdfTextDocument document = O
public static void convertOdtToPdf(String inputFilename , String outputFilename) throws Exception{
InputStream in= new FileInputStream(new File(inputFilename));
OdfTextDocument document = OdfTextDocument.loadDocument(in);
PdfOptions options = PdfOptions.create();
OutputStream out = new FileOutputStream(new File(outputFilename));
PdfConverter.getInstance().convert(document, out, options);
}
但是运行这个之后,我得到了如下错误
java.lang.VerifyError: (class: org/odftoolkit/odfdom/pkg/OdfPackage, method: getDom signature: (Ljava/lang/String;)Lorg/w3c/dom/Document;) Incompatible object argument for function call
2013-09-12 11:47:06,767 ERROR [STDERR] (WorkManager(2)-68) at org.odftoolkit.odfdom.doc.OdfDocument.loadDocument(OdfDocument.java:219)
我把所有的罐子都加上了。但是没有得到任何结果。可能是ODFDOM版本有问题。我建议您只使用odt.converters-*-sample.zip提供的JAR来尝试代码,您可以从Ya下载,我只使用该站点提供的JAR。这似乎是JDK的问题