Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to generate pdf file #10

Open
ysreddymca opened this issue Nov 2, 2024 · 1 comment
Open

unable to generate pdf file #10

ysreddymca opened this issue Nov 2, 2024 · 1 comment

Comments

@ysreddymca
Copy link

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant