java - exception during convert html to pdf using itext -
i trying convert html pdf file in java using itext.i using eclipse editor,i have add 2 jar file
xmlworker-5.4.3.jar, itextpdf-5.1.0.jar
in classpath.my code given beloow
document document = new document(); pdfwriter writer = pdfwriter.getinstance(document, new fileoutputstream("pdf.pdf")); document.open(); xmlworkerhelper.getinstance().parsexhtml(writer, document,new fileinputstream("index.html")); system.out.println( "pdf created!" );
when run above code gives me exception. don't know how solve it. exception given below
exception in thread "main" java.lang.nosuchmethoderror: com.itextpdf.text.log.loggerfactory.getlogger(ljava/lang/class;)lcom/itextpdf /text/log/loger; @ com.itextpdf.tool.xml.net.fileretrieveimpl.<clinit> (fileretrieveimpl.java:67)at com.itextpdf.tool.xml.css.styleattrcssresolver. <init> (styleattrcssresolver.java:113) @ com.itextpdf.tool.xml.css.styleattrcssresolver.<init> (styleattrcssresolver.java:102) @ com.itextpdf.tool.xml.css.styleattrcssresolver.<init> (styleattrcssresolver.java:90) @ om.itextpdf.tool.xml.xmlworkerhelper.parsexhtml(xmlworkerhelper.java:213) @ df.tool.xml.xmlworkerhelper.parsexhtml(xmlworkerhelper.java:185) @ com.ps.app.main(app.java:47)
i think error @ place
xmlworkerhelper.getinstance().parsexhtml(writer, document,new fileinputstream("index.html"));
help me hove solve exception..... in advance.
it seems versions of these jars not compatible each other. try below versions , let know xmlworker-5.4.5.jar, itextpdf-5.4.5.jar
Comments
Post a Comment