runtime error for org.xhtmlrenderer.pdf.ITextRenderer

Avatar

Avatar

Dipanjan1986

Avatar

Dipanjan1986

Dipanjan1986

03-11-2020

I am trying to do a poc for html to pdf generation.

I am using the dependency as below. 

 

<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-core</artifactId>
<version>9.1.20</version>
</dependency>
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf-openpdf</artifactId>
<version>9.1.20</version>
</dependency>
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf-itext5</artifactId>
<version>9.1.20</version>
</dependency>

<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf-osgi</artifactId>
<version>9.1.2</version>
</dependency>
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-core</artifactId>
<version>9.1.20</version>
</dependency>

<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf-openpdf</artifactId>
<version>9.1.20</version>
</dependency>
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf</artifactId>
<version>9.1.20</version>
</dependency>

 

and in plugin I have added this line 

<Import-Package>javax.inject;version=0.0.0,org.xhtmlrenderer.*;resolution:=optional,*</Import-Package>

 

The build is fine and the bundle is active. 

In my code I am able to get the apis of ITextRenderer. 

org.xhtmlrenderer.pdf.ITextRenderer iTextRenderer = new org.xhtmlrenderer.pdf.ITextRenderer();

 

But on Runtime I am getting this exception in error.log.

java.lang.ClassNotFoundException: org.xhtmlrenderer.pdf.ITextRenderer

 

Anyone please help ? 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

kiranparab

Avatar

kiranparab

kiranparab

03-11-2020

Looks like Depedency is not enough to cover this package to get imported for PDF package "org.xhtmlrenderer.pdf.ITextRenderer iTextRenderer" as it is still in installed state.

 

If you are building this using Eclipse, After package build please see if you find the below JAR getting downloaded in Eclipse with this respected class available "org.xhtmlrenderer.pdf.ITextRenderer iTextRenderer". If not means you are missing the depdency to fullfill the package requirement for "org.xhtmlrenderer.pdf.ITextRenderer iTextRenderer".

 

Answers (1)

Answers (1)

Avatar

Avatar

Anudeep_Garnepudi

Avatar

Anudeep_Garnepudi

Anudeep_Garnepudi

03-11-2020

Hi @Dipanjan1986 

Does itextpdf is in your bundle classpath? If not try adding to your bundle and check once.

AG