opensagres / xdocreport.samples

XDocReport Samples
https://github.com/opensagres/xdocreport
GNU Lesser General Public License v3.0
54 stars 58 forks source link

unable to generate pdf file #10

Open ysreddymca opened 3 weeks ago

ysreddymca commented 3 weeks ago

Hi

My code is able to generate the target odt file, but failing to generate target pdf file. I am using below libraries & code and pasted the error below. please help me.

libraries

xdocreport-2.1.0.jar slf4j-api-1.7.2.jar velocity-engine-core-2.4.1.jar odfdom-java-0.12.0-jar-with-dependencies.jar itext-2.1.7.jar

java code

IXDocReport report = XDocReportRegistry.getRegistry().loadReport(infile, TemplateEngineKind.Velocity); IContext context = report.createContext(); context.put("name", "tester"); OutputStream outfile = new FileOutputStream(new File("outfile.odt")); report.process(context, outfile); //this is working perfectly

OutputStream outfile1 = new FileOutputStream(new File("outfile.pdf")); Options options = Options.getTo(ConverterTypeTo.PDF).via(ConverterTypeVia.ODFDOM); report.convert(context, options, outfile1); //this is giving problem and generating zero size pdf file

runtime error

java.lang.NoSuchMethodError: 'org.odftoolkit.odfdom.incubator.doc.office.OdfOfficeAutomaticStyles org.odftoolkit.odfdom.dom.OdfStylesDom.getAutomaticStyles()'

ysreddymca commented 3 weeks ago

I have added few more libraries to my lib folder. Now the list and new runtime error is as below. Please help me to identify the solution.

libraries itext-2.1.7.jar java-rdfa-0.4.2.jar jena-core-5.2.0.jar jena-iri-5.2.0.jar odfdom-java-0.12.0.jar slf4j-api-1.7.2.jar velocity-engine-core-2.4.1.jar xdocreport-2.1.0.jar xerces-2.4.0.jar xercesImpl.2.12.2.jar

Now my runtime error is fr.opensagres.odfdom.converter.core.ODFConverterException: java.lang.NullPointerException: Cannot invoke "org.odftoolkit.odfdom.pkg.manifest.OdfFileEntry.getEncryptionData()" because "manifestEntry" is null