itext7 - iText 7 Hello World example fails with NoClassDefFoundError -
working down first example of itext 7 code causes noclassdeffounderror @ step 4. if can point error coming helpful?
import com.itextpdf.kernel.pdf.pdfwriter import com.itextpdf.kernel.pdf.pdfdocument import com.itextpdf.layout.document import com.itextpdf.layout.element.paragraph //step 1 - writer writer = new pdfwriter(new fileoutputstream(dest)) //step 2 - pdf pdf = new pdfdocument(writer) //step 3 - document document = new document(pdf) //step 4 - content document.add( new paragraph ( 'hello world!' ) )
this produces
java.lang.noclassdeffounderror: not initialize class com.itextpdf.io.font.fontprogramfactory
code being run under groovy why more sparse io, kernel , layout jars loaded.
did watch video on how install itext 7? error message tells you didn't include io jar. assumption have added kernel , layout jar classpath, overlooked adding io jar.
these of documented dependencies in before start: installing itext 7 section of jump-start tutorial:
<dependency> <groupid>com.itextpdf</groupid> <artifactid>kernel</artifactid> <version>7.0.0</version> <scope>compile</scope> </dependency> <dependency> <groupid>com.itextpdf</groupid> <artifactid>io</artifactid> <version>7.0.0</version> <scope>compile</scope> </dependency> <dependency> <groupid>com.itextpdf</groupid> <artifactid>layout</artifactid> <version>7.0.0</version> <scope>compile</scope> </dependency>
as explained in videos, io jar dependency of kernel jar.
you write:
the io, kernel , layout jars loaded.
the error message shared, tells me io jar isn't loaded. com.itextpdf.io.font.fontprogramfactory
class stored in jar.
Comments
Post a Comment