I am new to itext7, I am using Eclipse IDE. I downloaded all the itext7 jar files and added it to my libraries (classpath). When I run my program (to convert text file to PDF file), I got the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at com.itextpdf.kernel.pdf.PdfPagesTree.<clinit>(PdfPagesTree.java:72)
at com.itextpdf.kernel.pdf.PdfCatalog.<init>(PdfCatalog.java:99)
at com.itextpdf.kernel.pdf.PdfCatalog.<init>(PdfCatalog.java:103)
at com.itextpdf.kernel.pdf.PdfDocument.open(PdfDocument.java:1958)
at com.itextpdf.kernel.pdf.PdfDocument.<init>(PdfDocument.java:284)
at com.itextpdf.kernel.pdf.PdfDocument.<init>(PdfDocument.java:265)
at TextFileToPDF.createPdf(TextFileToPDF.java:59)
at TextFileToPDF.main(TextFileToPDF.java:84)
`Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 8 more
If I add all the jar files to my libraries(ModulePath), then I got the following errors:
Error: Unable to initialize main class TextFileToPDF Caused by: java.lang.NoClassDefFoundError: com/itextpdf/layout/element/IBlockElement
Does anybody knows how to fix this problem?