这是我的代码,我遇到了运行时错误
“线程“主”中的异常java.lang.NoClassDefFoundError: com / itextpdf / kernel / counter / event / IMetaInfo”。
/** The HTML-string that we are going to convert to PDF. */
public static final String HTML = "<h1>Test</h1><p>Hello World</p>";
/** The target folder for the result. */
public static final String TARGET = "target/results/ch01/";
/** The path to the resulting PDF file. */
public static final String DEST = String.format("%stest-1.pdf", TARGET);
/**
* The main method of this example.
*
* @param args no arguments are needed to run this example.
* @throws IOException Signals that an I/O exception has occurred.
*/
public static void main(String[] args) throws IOException {
File file = new File(TARGET);
file.mkdirs();
new HelloWorld().createPdf(HTML, DEST);
}
/**
* Creates the PDF file.
*
* @param html the HTML as a String value
* @param dest the path of the resulting PDF
* @throws IOException Signals that an I/O exception has occurred.
*/
public void createPdf(String html, String dest) throws IOException {
HtmlConverter.convertToPdf(html, new FileOutputStream(dest));
}